summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 5332f801..bdbd2eed 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -470,11 +470,6 @@ static int cmd_resize(int argc, char **argv)
amount = argv[1];
path = argv[2];
- fd = open_file_or_dir(path);
- if (fd < 0) {
- fprintf(stderr, "ERROR: can't access to '%s'\n", path);
- return 12;
- }
len = strlen(amount);
if (len == 0 || len >= BTRFS_VOL_NAME_MAX) {
fprintf(stderr, "ERROR: size value too long ('%s)\n",
@@ -482,9 +477,14 @@ static int cmd_resize(int argc, char **argv)
return 14;
}
+ fd = open_file_or_dir(path);
+ if (fd < 0) {
+ fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+ return 12;
+ }
+
printf("Resize '%s' of '%s'\n", path, amount);
- strncpy(args.name, amount, BTRFS_PATH_NAME_MAX);
- args.name[BTRFS_PATH_NAME_MAX-1] = 0;
+ strncpy_null(args.name, amount);
res = ioctl(fd, BTRFS_IOC_RESIZE, &args);
e = errno;
close(fd);