Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add f3write --keep and f3read --delete parameters #140

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions f3read.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ static struct argp_option options[] = {
"Maximum read rate", 0},
{"show-progress", 'p', "NUM", 0,
"Show progress if NUM is not zero", 0},
{"delete", 'd', NULL, 0,
"delete corrupted NUM.h2w file", 0},
{"delete", 'd', NULL, 0,
"Delete corrupted NUM.h2w files", 0},
{ 0 }
};

Expand Down Expand Up @@ -386,11 +386,13 @@ static void iterate_files(const char *path, const long *files,
tot_overwritten += stats.secs_overwritten;
tot_size += stats.bytes_read;
and_read_all = and_read_all && stats.read_all;
if (stats.secs_corrupted && delete) {
if (delete && (stats.secs_corrupted || tot_changed || tot_overwritten)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace tot_changed with stats.secs_changed and tot_overwritten with stats.secs_overwritten. My fault, again.

Break the line as needed to fit within the 80-column limit.

const char *filename;
char *full_fn = full_fn_from_number(&filename, path, *files);
assert(full_fn)
if (unlink(full_fn))
err(errno, "Can't remove file %s\n", full_fn);
free(full_fn);
}
files++;
}
Expand Down