diff options
Diffstat (limited to 'src/file_processor.c')
| -rw-r--r-- | src/file_processor.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/file_processor.c b/src/file_processor.c index b2b4f85..0f4af9f 100644 --- a/src/file_processor.c +++ b/src/file_processor.c @@ -190,6 +190,7 @@ int process_file(struct df_fileinfo *info) { size_t bytes_read; struct df_md_components *ctx_pkg; bool error_in_loop = false; + struct df_fileinfo info_from_db; unsigned char md_val[EVP_MAX_MD_SIZE]; unsigned int md_len; @@ -218,6 +219,24 @@ int process_file(struct df_fileinfo *info) { return -1; } + /* filesystem information collected check whether the DB has a corresponding value, + * if so check by size and time whether it looks modified if not, skip + * TODO: option_force needs to be implemented AND memory clean up*/ + info_from_db.path = info->path; + info_from_db.name = info->name; + if ((dbi_fill_fileinfo(&info_from_db) == 0) && + (info->statbuf.st_size == info_from_db.statbuf.st_size) && + (info->statbuf.st_mtim.tv_sec < info_from_db.last_seen) && + (info->statbuf.st_mtim.tv_sec == info_from_db.statbuf.st_mtim.tv_sec) && + (info->statbuf.st_mtim.tv_nsec == info_from_db.statbuf.st_mtim.tv_nsec)) { + if ( ! option_quiet ) { + LOGERR("Skip file '%s' file unchanged according to metadata\n", fullpath); + } + dbi_update_fileinfo_last_seen(info_from_db.id); + return 0; + } + + if ((ctx_pkg = init_md_components()) == NULL) { LOGERR("ERROR: Failed to initialize/create md contexts to be used with %s\n", fullpath); |
