Skip to content

Commit

Permalink
file: report 0 actual_file_size for non-duplicate-file types
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeSpotRun committed Apr 20, 2021
1 parent 87d7097 commit 3c1a8e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ RmFile *rm_file_new(struct RmSession *session, const char *path, RmStat *statp,
} else {
file_size = actual_file_size * cfg->skip_end_factor;
}

if(type == RM_LINT_TYPE_DUPE_CANDIDATE || type == RM_LINT_TYPE_PART_OF_DIRECTORY) {
/* Check if the actual slice the file will be > 0; we don't want empty files in
* shredder */
if((file_size - start_seek) == 0 && actual_file_size != 0) {
return NULL;
}
}
else {
// report other types as zero-size
actual_file_size = 0;
}

RmFile *self = g_slice_new0(RmFile);
self->session = session;
Expand Down Expand Up @@ -96,7 +101,6 @@ RmFile *rm_file_new(struct RmSession *session, const char *path, RmStat *statp,
self->outer_link_count = -1;

self->ref_count = 1;

return self;
}

Expand Down

0 comments on commit 3c1a8e2

Please sign in to comment.