btrfs-progs: subvol list: setup list filters later
authorDavid Sterba <dsterba@suse.com>
Mon, 31 Oct 2016 10:40:23 +0000 (11:40 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 9 Nov 2016 12:47:29 +0000 (13:47 +0100)
First check for arguments and whether we can open the filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
cmds-subvolume.c

index 3b5d6ea..0d2f973 100644 (file)
@@ -530,10 +530,6 @@ static int cmd_subvol_list(int argc, char **argv)
                }
        }
 
-       if (flags)
-               btrfs_list_setup_filter(&filter_set, BTRFS_LIST_FILTER_FLAGS,
-                                       flags);
-
        if (check_argc_exact(argc - optind, 1)) {
                uerr = 1;
                goto out;
@@ -547,6 +543,10 @@ static int cmd_subvol_list(int argc, char **argv)
                goto out;
        }
 
+       if (flags)
+               btrfs_list_setup_filter(&filter_set, BTRFS_LIST_FILTER_FLAGS,
+                                       flags);
+
        ret = btrfs_list_get_path_rootid(fd, &top_id);
        if (ret)
                goto out;