diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-03-04 16:39:59 -0600 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-03-10 16:01:14 +0100 |
commit | 323318fd3500a447987d355f6189230ecc0d4256 (patch) | |
tree | e7fa01a42ff15576d2d8b99583a24a041be72ba2 /cmds-subvolume.c | |
parent | 6ddd81d6d7bcb9196f9700b93df1ceba87b0a4c5 (diff) | |
download | btrfs-progs-323318fd3500a447987d355f6189230ecc0d4256.tar.gz |
btrfs-progs: tidy up cmd_subvol_create() whitespace & returns
Just whitespace fixes, and magical return value removal.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r-- | cmds-subvolume.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 01b982c..a9999ac 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -104,9 +104,9 @@ static int cmd_subvol_create(int argc, char **argv) dst = argv[optind]; res = test_isdir(dst); - if(res >= 0 ){ + if (res >= 0) { fprintf(stderr, "ERROR: '%s' exists\n", dst); - return 12; + return 1; } newname = strdup(dst); @@ -114,24 +114,24 @@ static int cmd_subvol_create(int argc, char **argv) dstdir = strdup(dst); dstdir = dirname(dstdir); - if( !strcmp(newname,".") || !strcmp(newname,"..") || + if (!strcmp(newname, ".") || !strcmp(newname, "..") || strchr(newname, '/') ){ fprintf(stderr, "ERROR: uncorrect subvolume name ('%s')\n", newname); - return 14; + return 1; } len = strlen(newname); if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { fprintf(stderr, "ERROR: subvolume name too long ('%s)\n", newname); - return 14; + return 1; } fddst = open_file_or_dir(dstdir); if (fddst < 0) { fprintf(stderr, "ERROR: can't access to '%s'\n", dstdir); - return 12; + return 1; } printf("Create subvolume '%s/%s'\n", dstdir, newname); @@ -159,10 +159,10 @@ static int cmd_subvol_create(int argc, char **argv) close(fddst); free(inherit); - if(res < 0 ){ - fprintf( stderr, "ERROR: cannot create subvolume - %s\n", + if (res < 0) { + fprintf(stderr, "ERROR: cannot create subvolume - %s\n", strerror(e)); - return 11; + return 1; } return 0; |