summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-03-04 16:40:03 -0600
committerDavid Sterba <dsterba@suse.cz>2013-03-10 16:06:37 +0100
commit6626354fdf00ce8d61edc69c0d65d283ef99c69c (patch)
tree888eb88cb1d70d0baf472cfb61a937df600305b7
parent7b81119b1d3904cf00ec29140e8bc5d86a12902f (diff)
btrfs-progs: better option/error handling for btrfs-vol
Today wrong cmdlines give odd results: # ./btrfs-vol /dev/sdb1 Unable to open device (null) # ./btrfs-vol -a /dev/sdb1 usage: btrfs-vol [options] mount_point ... Make it a bit more informative: # ./btrfs-vol /dev/sdb1 No command specified usage: btrfs-vol [options] mount_point ... # ./btrfs-vol -a /dev/sdb1 No mountpoint specified usage: btrfs-vol [options] mount_point ... (even though it's deprecated ...) Signed-off-by: Eric Sandeen <sandeen@redhat.com>
-rw-r--r--btrfs-vol.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/btrfs-vol.c b/btrfs-vol.c
index 3cc1c327..e37b41ab 100644
--- a/btrfs-vol.c
+++ b/btrfs-vol.c
@@ -106,8 +106,13 @@ int main(int ac, char **av)
}
}
ac = ac - optind;
- if (ac == 0)
+ if (ac == 0 || !cmd) {
+ if (!ac)
+ fprintf(stderr, "No mountpoint specified\n");
+ else
+ fprintf(stderr, "No command specified\n");
print_usage();
+ }
mnt = av[optind];
if (device && strcmp(device, "missing") == 0 &&