diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-09-15 11:56:00 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-09-15 12:34:13 -0400 |
commit | 4eefef7868a260c1dc8abfc206a7dc33341558be (patch) | |
tree | ccb08ca24109e124866dd9b6f988a901a12c579c /c_src | |
parent | ad41f28c4c88ab6f15448b4e505c6b9aa27c0a7b (diff) |
scrub: Return code now indicates corrected/uncorrected errors
Matches error codes of fsck for corrected/uncorrected errors.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/cmd_data.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/c_src/cmd_data.c b/c_src/cmd_data.c index 190c178c..a2ec058a 100644 --- a/c_src/cmd_data.c +++ b/c_src/cmd_data.c @@ -80,7 +80,7 @@ static int cmd_data_scrub(int argc, char *argv[]) .op = BCH_DATA_OP_scrub, .scrub.data_types = ~0, }; - int opt; + int ret = 0, opt; while ((opt = getopt_long(argc, argv, "hm", longopts, NULL)) != -1) switch (opt) { @@ -187,6 +187,11 @@ static int cmd_data_scrub(int argc, char *argv[]) dev->corrected = e.p.sectors_error_corrected; dev->uncorrected= e.p.sectors_error_uncorrected; dev->total = e.p.sectors_total; + + if (dev->corrected) + ret |= 2; + if (dev->uncorrected) + ret |= 4; } if (dev->progress_fd >= 0 && e.ret) { @@ -253,7 +258,7 @@ static int cmd_data_scrub(int argc, char *argv[]) fputs("\n", stdout); printbuf_exit(&buf); - return 0; + return ret; } static void data_job_usage(void) |