path[i] = '\0';
ret = mkdir(path, 0777);
if (ret && errno != EEXIST)
- return 1;
+ return -errno;
path[i] = '/';
}
if (fdmnt < 0) {
ERR(!do_quiet, "ERROR: can't access '%s'\n", path);
- return 12;
+ return 1;
}
ret = get_fs_info(path, &fi_args, &di_args);
if (!do_quiet)
printf("scrub: nothing to resume for %s, fsid %s\n",
path, fsid);
- err = 0;
- goto out;
+ return 2;
}
ret = prg_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (err)
return 1;
if (e_correctable)
- return 7;
+ return 3;
if (e_uncorrectable)
- return 8;
+ return 4;
return 0;
}
if (ret < 0) {
fprintf(stderr, "ERROR: scrub cancel failed on %s: %s\n", path,
errno == ENOTCONN ? "not running" : strerror(errno));
- ret = 1;
+ if (errno == ENOTCONN)
+ ret = 2;
+ else
+ ret = 1;
goto out;
}
if (fdmnt < 0) {
fprintf(stderr, "ERROR: can't access to '%s'\n", path);
- return 12;
+ return 1;
}
ret = get_fs_info(path, &fi_args, &di_args);
close(fdres);
close_file_or_dir(fdmnt, dirstream);
- return err;
+ return !!err;
}
const struct cmd_group scrub_cmd_group = {