btrfs-progs: fix name lengths in cmd_subvol_create
cmd_subvol_create() calls either BTRFS_IOC_SUBVOL_CREATE or BTRFS_IOC_SUBVOL_CREATE_V2 depending on whether or not inherit is set. However, these 2 ioctls have different args structures with different length name[] members. In the BTRFS_IOC_SUBVOL_CREATE case, the arg is btrfs_ioctl_vol_args, with a BTRFS_PATH_NAME_MAX length name, not a BTRFS_SUBVOL_NAME_MAX length name. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
parent
dbeedbed2a
commit
7ced17b07f
1 changed files with 2 additions and 2 deletions
|
@ -149,8 +149,8 @@ static int cmd_subvol_create(int argc, char **argv)
|
|||
struct btrfs_ioctl_vol_args args;
|
||||
|
||||
memset(&args, 0, sizeof(args));
|
||||
strncpy(args.name, newname, BTRFS_SUBVOL_NAME_MAX);
|
||||
args.name[BTRFS_SUBVOL_NAME_MAX-1] = 0;
|
||||
strncpy(args.name, newname, BTRFS_PATH_NAME_MAX);
|
||||
args.name[BTRFS_PATH_NAME_MAX-1] = 0;
|
||||
|
||||
res = ioctl(fddst, BTRFS_IOC_SUBVOL_CREATE, &args);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue