summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-01-25 13:27:46 -0600
committerZach Brown <zab@redhat.com>2013-02-05 16:09:41 -0800
commit7ced17b07f9524c999395240458a46e403036d6b (patch)
treedc69f6c61df3fa926bd43cc4ea57033ba0a58da0 /cmds-subvolume.c
parentdbeedbed2aeb87c9add3c147c46a574b0e34be61 (diff)
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>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index af04a6b8..1432b997 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -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);
}