From d0f3eae161a31eecef25946100afb994e6abc6eb Mon Sep 17 00:00:00 2001 From: Renan Date: Tue, 2 Jun 2026 00:04:05 -0300 Subject: [PATCH 1/2] Minor change on the CI/CD setup --- src/mm_scan.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mm_scan.c b/src/mm_scan.c index 436ffcc..2e102b2 100644 --- a/src/mm_scan.c +++ b/src/mm_scan.c @@ -6,12 +6,31 @@ #include "mm_sha256.h" #include "mm_util.h" +static const time_t MM_MIN_CANDIDATE_AGE_SECONDS = 30; + static int mm_compare_candidates(const void *left, const void *right) { const mm_image_candidate_t *a = left; const mm_image_candidate_t *b = right; return strcmp(a->source_path, b->source_path); } +static bool mm_candidate_is_old_enough(const struct stat *st) { + time_t now; + double age_seconds; + + if (!st) + return false; + + now = time(NULL); + if (now == (time_t)-1) { + mm_log_warn("SCAN", "failed to get current time while checking candidate"); + return false; + } + + age_seconds = difftime(now, st->st_mtime); + return age_seconds >= (double)MM_MIN_CANDIDATE_AGE_SECONDS; +} + static bool mm_candidate_list_contains_source(const mm_candidate_list_t *list, const char *source_path) { size_t index; @@ -182,6 +201,10 @@ static bool mm_scan_directory(const mm_config_t *config, continue; if (!mm_string_ends_with_ignore_case(entry->d_name, ".ffpfsc")) continue; + if (!mm_candidate_is_old_enough(&st)) { + mm_log_debug("SCAN", "skipping recently modified file: %s", full_path); + continue; + } if (mm_candidate_list_contains_source(list, full_path)) continue; From 65c115e4fb2d764831962477522c3218fd9ec250 Mon Sep 17 00:00:00 2001 From: Renan Date: Tue, 2 Jun 2026 01:03:01 -0300 Subject: [PATCH 2/2] Minor change on the CI/CD setup --- src/mm_mount.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mm_mount.c b/src/mm_mount.c index 3c61dcf..9fc5d34 100644 --- a/src/mm_mount.c +++ b/src/mm_mount.c @@ -392,6 +392,28 @@ static bool mm_candidate_mount_path_exists(const mm_candidate_list_t *candidates return false; } +static bool mm_ensure_parent_directories(const char *path) { + char parent[PATH_MAX]; + char *slash; + + if (!path || path[0] == '\0') + return false; + + if (!mm_copy_string(parent, sizeof(parent), path)) + return false; + + slash = strrchr(parent, '/'); + if (!slash) + return true; + + if (slash == parent) + slash[1] = '\0'; + else + *slash = '\0'; + + return mm_ensure_dir_recursive(parent); +} + static bool mm_cleanup_mount_path(const mm_managed_mount_t *item) { bool empty_after = false; @@ -439,6 +461,12 @@ static bool mm_mount_candidate(const mm_config_t *config, return false; } + if (!mm_ensure_parent_directories(candidate->mount_path)) { + mm_log_error("MOUNT", "failed to create parent directories for %s: %s", + candidate->mount_path, strerror(errno)); + return false; + } + if (!mm_ensure_dir_recursive(candidate->mount_path)) { mm_log_error("MOUNT", "failed to create %s: %s", candidate->mount_path, strerror(errno));