summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@fusionio.com>2013-02-06 12:51:58 -0500
committerChris Mason <chris.mason@fusionio.com>2013-02-06 12:51:58 -0500
commit82ac34581e8fae6ef3f84758361c75f5b30c576d (patch)
treeb7bb32f9e4b4f5989cc148543bf2782abb0a1c93 /cmds-filesystem.c
parent7b1c567c84a6292c138db3bd1638e19e73e0e593 (diff)
parent2986545ccd655273658e0e4463a669bb1893ba68 (diff)
Merge branch 'cov-fixes-v1-integration-20130201' of http://git.zabbo.net/cgit/btrfs-progs into merged
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);