mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-27 16:42:17 +00:00
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.
This commit is contained in:
parent
fd4bca3dfe
commit
d751af515b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user