btrfs-progs: qgroup create: accept only valid qgroupid

Many qgroup commands accept the level/id format and also a path to
subvolume, the qgroup id is derived from that. This does not make sense
for the create command as we can't create the 0/subvolid qgroup (thus
can't be derived from the path), only the higher levels.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-09-07 14:00:22 +02:00
parent 47b04b747d
commit 9be1b1c442

View File

@ -142,7 +142,11 @@ static int _cmd_qgroup_create(int create, int argc, char **argv)
memset(&args, 0, sizeof(args));
args.create = create;
args.qgroupid = parse_qgroupid_or_path(argv[optind]);
ret = parse_qgroupid(argv[optind], &args.qgroupid);
if (ret < 0) {
error("invalid qgroupid %s", argv[optind]);
return 1;
}
path = argv[optind + 1];
fd = btrfs_open_dir(path, &dirstream, 1);