diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2026-03-01 21:38:14 +0100 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2026-03-01 21:38:14 +0100 |
| commit | 5cbb7eb30578031b8af0a9e987ad2285e5e88148 (patch) | |
| tree | 7a2f0e2a53c34dad2ba0c6141a22202fbf27b2e0 /src | |
| parent | 29b439c85aef85a1f0e6f7e7b254e6065f241e97 (diff) | |
| download | duplicate_finder-5cbb7eb30578031b8af0a9e987ad2285e5e88148.tar.gz duplicate_finder-5cbb7eb30578031b8af0a9e987ad2285e5e88148.tar.bz2 | |
If skipped don't attempt insert
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_processor.c | 15 |
1 files changed, 10 insertions, 5 deletions
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); |
