From 5cbb7eb30578031b8af0a9e987ad2285e5e88148 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Sun, 1 Mar 2026 21:38:14 +0100 Subject: If skipped don't attempt insert --- src/file_processor.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/file_processor.c b/src/file_processor.c index 0f4af9f..9e12c52 100644 --- a/src/file_processor.c +++ b/src/file_processor.c @@ -180,7 +180,8 @@ inline void destroy_md_components(struct df_md_components *pkg) { * @param info struct contains the path of the file to read, results will be * stored there. * - * @return 0 on success + * @return 1 if skipped + * 0 on success * -1 on failure */ int process_file(struct df_fileinfo *info) { @@ -233,7 +234,7 @@ int process_file(struct df_fileinfo *info) { LOGERR("Skip file '%s' file unchanged according to metadata\n", fullpath); } dbi_update_fileinfo_last_seen(info_from_db.id); - return 0; + return 1; } @@ -375,7 +376,7 @@ struct df_fileinfo *prepare_fileinfo(char *key) { int process_gdbm_content() { char *key, *tmpkey; struct df_fileinfo *info; - int dbrc = 0; + int dbrc = 0, fsrc = 0; key = kv_first_key(); while (key != NULL) { @@ -396,7 +397,8 @@ int process_gdbm_content() { LOGERR("ERROR: Preparing struct for key %s failed.\n", key); return -1; } - if (process_file(info) < 0) { + fsrc = process_file(info); + if (fsrc < 0) { LOGERR("ERROR: Failed to process file %s\n", key); free(info->path); free(info->name); @@ -408,7 +410,10 @@ int process_gdbm_content() { #ifdef DEBUGBUILD print_fileinfo(info); #endif - dbrc = dbi_insert_fileinfo(info); + /* process_file 1 -> skip hashes etc not copied */ + if (fsrc == 0) { + dbrc = dbi_insert_fileinfo(info); + } free(info->path); free(info->name); free(info); -- cgit v1.3