btrfs-progs: restore: don't allow users to specify -r and -f at the same time
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Thu, 19 Jun 2014 01:27:08 +0000 (09:27 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 22 Aug 2014 12:43:10 +0000 (14:43 +0200)
These two options are used for same purpose, but they are exclusive with
each other. Make it clear to common users.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-restore.c

index afcb347..310a84e 100644 (file)
@@ -1218,6 +1218,11 @@ int cmd_restore(int argc, char **argv)
        else if (list_roots && optind >= argc)
                usage(cmd_restore_usage);
 
+       if (fs_location && root_objectid) {
+               fprintf(stderr, "don't use -f and -r at the same time.\n");
+               return 1;
+       }
+
        if ((ret = check_mounted(argv[optind])) < 0) {
                fprintf(stderr, "Could not check mount status: %s\n",
                        strerror(-ret));