summaryrefslogtreecommitdiff
path: root/btrfsctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'btrfsctl.c')
-rw-r--r--btrfsctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/btrfsctl.c b/btrfsctl.c
index 01fd95aa..3710bc6a 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -33,11 +33,11 @@ int main(int ac, char **av)
int fd;
int ret;
struct btrfs_ioctl_vol_args args;
- char *name;
+ char *name = NULL;
int i;
struct stat st;
DIR *dirstream;
- unsigned long command;
+ unsigned long command = 0;
for (i = 1; i < ac - 1; i++) {
if (strcmp(av[i], "-s") == 0) {
@@ -65,6 +65,10 @@ int main(int ac, char **av)
command = BTRFS_IOC_ADD_DISK;
}
}
+ if (command == 0) {
+ fprintf(stderr, "no valid commands given\n");
+ exit(1);
+ }
fname = av[ac - 1];
printf("fname is %s\n", fname);
ret = stat(fname, &st);