diff options
author | Kyle McMartin <kyle@mcmartin.ca> | 2008-01-22 11:32:09 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2008-01-22 11:32:09 -0500 |
commit | d751af515b0ebe94a00b195d8510fc3770dadcef (patch) | |
tree | 29097deba53debfd9d500011a173f2f41b4fb647 /btrfsck.c | |
parent | fd4bca3dfea947f7031721be0a6ebf365b313fb8 (diff) |
Fix btrfsck args checking
btrfsck fails to check if it actually received a dev argument though, so if you
don't pass a device, we get a nice segfault.
Diffstat (limited to 'btrfsck.c')
-rw-r--r-- | btrfsck.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -709,6 +709,11 @@ int check_extent_refs(struct btrfs_root *root, return err; } +void print_usage(void) { + fprintf(stderr, "usage: btrfsck dev\n"); + exit(1); +} + int main(int ac, char **av) { struct btrfs_root *root; struct cache_tree extent_cache; @@ -727,6 +732,9 @@ int main(int ac, char **av) { int slot; struct btrfs_root_item ri; + if (ac < 2) + print_usage(); + radix_tree_init(); cache_tree_init(&extent_cache); cache_tree_init(&seen); |