summaryrefslogtreecommitdiff
path: root/cmds-rescue.c
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-12-11 10:30:30 +1100
committerDimitri John Ledkov <xnox@ubuntu.com>2018-12-11 10:30:30 +1100
commit59d2f4ec0b9dff7b56da34541dffd3e676adf584 (patch)
tree0f982d10b206f248f13de6ba48617e9bdae5e5f5 /cmds-rescue.c
parent3b9cf4c8cda0818e4d3f9892ece9f7d99de13b03 (diff)
parent5b162a39be9dec46a22c815f43fc337b920b4252 (diff)
Update upstream source from tag 'upstream/4.19.1'
Update to upstream version '4.19.1' with Debian dir 171bf4d92c150acf94e8e0a7633c4349c4e39ad6
Diffstat (limited to 'cmds-rescue.c')
-rw-r--r--cmds-rescue.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cmds-rescue.c b/cmds-rescue.c
index c40088ad..01fbdef9 100644
--- a/cmds-rescue.c
+++ b/cmds-rescue.c
@@ -32,8 +32,8 @@ static const char * const rescue_cmd_group_usage[] = {
NULL
};
-int btrfs_recover_chunk_tree(char *path, int verbose, int yes);
-int btrfs_recover_superblocks(char *path, int verbose, int yes);
+int btrfs_recover_chunk_tree(const char *path, int verbose, int yes);
+int btrfs_recover_superblocks(const char *path, int verbose, int yes);
static const char * const cmd_rescue_chunk_recover_usage[] = {
"btrfs rescue chunk-recover [options] <device>",
@@ -52,6 +52,7 @@ static int cmd_rescue_chunk_recover(int argc, char *argv[])
int yes = 0;
int verbose = 0;
+ optind = 0;
while (1) {
int c = getopt(argc, argv, "yvh");
if (c < 0)
@@ -76,7 +77,8 @@ static int cmd_rescue_chunk_recover(int argc, char *argv[])
ret = check_mounted(file);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
return 1;
} else if (ret) {
error("the device is busy");
@@ -109,7 +111,7 @@ static const char * const cmd_rescue_super_recover_usage[] = {
* 0 : All superblocks are valid, no need to recover
* 1 : Usage or syntax error
* 2 : Recover all bad superblocks successfully
- * 3 : Fail to Recover bad supeblocks
+ * 3 : Fail to Recover bad superblocks
* 4 : Abort to recover bad superblocks
*/
static int cmd_rescue_super_recover(int argc, char **argv)
@@ -119,6 +121,7 @@ static int cmd_rescue_super_recover(int argc, char **argv)
int yes = 0;
char *dname;
+ optind = 0;
while (1) {
int c = getopt(argc, argv, "vy");
if (c < 0)
@@ -140,7 +143,8 @@ static int cmd_rescue_super_recover(int argc, char **argv)
dname = argv[optind];
ret = check_mounted(dname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
return 1;
} else if (ret) {
error("the device is busy");
@@ -173,7 +177,8 @@ static int cmd_rescue_zero_log(int argc, char **argv)
devname = argv[optind];
ret = check_mounted(devname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
goto out;
} else if (ret) {
error("%s is currently mounted", devname);
@@ -224,7 +229,8 @@ static int cmd_rescue_fix_device_size(int argc, char **argv)
devname = argv[optind];
ret = check_mounted(devname);
if (ret < 0) {
- error("could not check mount status: %s", strerror(-ret));
+ errno = -ret;
+ error("could not check mount status: %m");
goto out;
} else if (ret) {
error("%s is currently mounted", devname);