summaryrefslogtreecommitdiff
path: root/btrfstune.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2013-12-18 11:52:45 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:21 -0800
commitf1bb766b3b387ce67ab377ad87af7c5d93b12803 (patch)
treed7a8d8cf11f806216510b482944045bb9835f86a /btrfstune.c
parentec3fbfcb5534a70b3a936aca348e9abe69102876 (diff)
btrfs-progs: fix btrfstune silence on failure
Originally, btrfstune will fail without any options, like this: # btrfstune /dev/sdb An error prompt & usage should show up upon this condition. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'btrfstune.c')
-rw-r--r--btrfstune.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/btrfstune.c b/btrfstune.c
index 50724bae..da82f360 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -115,6 +115,7 @@ int main(int argc, char *argv[])
int skinny_flag = 0;
int ret;
+ optind = 1;
while(1) {
int c = getopt(argc, argv, "S:rx");
if (c < 0)
@@ -143,6 +144,13 @@ int main(int argc, char *argv[])
return 1;
}
+ if (!(seeding_flag + extrefs_flag + skinny_flag)) {
+ fprintf(stderr,
+ "ERROR: At least one option should be assigned.\n");
+ print_usage();
+ return 1;
+ }
+
if (check_mounted(device)) {
fprintf(stderr, "%s is mounted\n", device);
return 1;
@@ -176,6 +184,7 @@ int main(int argc, char *argv[])
} else {
root->fs_info->readonly = 1;
ret = 1;
+ fprintf(stderr, "btrfstune failed\n");
}
close_ctree(root);