From patchwork Mon Mar 4 22:39:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 2214741 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 282A6DFF33 for ; Mon, 4 Mar 2013 21:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932642Ab3CDVkz (ORCPT ); Mon, 4 Mar 2013 16:40:55 -0500 Received: from nat-pool-rdu.redhat.com ([66.187.233.202]:8527 "EHLO bp-05.lab.msp.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932564Ab3CDVkc (ORCPT ); Mon, 4 Mar 2013 16:40:32 -0500 Received: by bp-05.lab.msp.redhat.com (Postfix, from userid 0) id 0035F1E0AB2; Mon, 4 Mar 2013 16:40:07 -0600 (CST) From: Eric Sandeen To: linux-btrfs@vger.kernel.org Cc: Eric Sandeen Subject: [PATCH 07/14] btrfs-progs: tidy up cmd_snapshot() whitespace & returns Date: Mon, 4 Mar 2013 16:39:57 -0600 Message-Id: <1362436804-16766-8-git-send-email-sandeen@redhat.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1362436804-16766-1-git-send-email-sandeen@redhat.com> References: <1362436804-16766-1-git-send-email-sandeen@redhat.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Just whitespace fixes, and magical return value removal. Signed-off-by: Eric Sandeen --- cmds-subvolume.c | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index a13a58d..a4d88a1 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -533,57 +533,57 @@ static int cmd_snapshot(int argc, char **argv) dst = argv[optind + 1]; res = test_issubvolume(subvol); - if(res<0){ + if (res < 0) { fprintf(stderr, "ERROR: error accessing '%s'\n", subvol); - return 12; + return 1; } - if(!res){ + if (!res) { fprintf(stderr, "ERROR: '%s' is not a subvolume\n", subvol); - return 13; + return 1; } res = test_isdir(dst); - if(res == 0 ){ + if (res == 0) { fprintf(stderr, "ERROR: '%s' exists and it is not a directory\n", dst); - return 12; + return 1; } - if(res>0){ + if (res > 0) { newname = strdup(subvol); newname = basename(newname); dstdir = dst; - }else{ + } else { newname = strdup(dst); newname = basename(newname); dstdir = strdup(dst); dstdir = dirname(dstdir); } - if( !strcmp(newname,".") || !strcmp(newname,"..") || + if (!strcmp(newname,".") || !strcmp(newname,"..") || strchr(newname, '/') ){ fprintf(stderr, "ERROR: incorrect snapshot name ('%s')\n", newname); - return 14; + return 1; } len = strlen(newname); if (len == 0 || len >= BTRFS_VOL_NAME_MAX) { fprintf(stderr, "ERROR: snapshot 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; } fd = open_file_or_dir(subvol); if (fd < 0) { close(fddst); fprintf(stderr, "ERROR: can't access to '%s'\n", dstdir); - return 12; + return 1; } if (readonly) { @@ -609,10 +609,10 @@ static int cmd_snapshot(int argc, char **argv) close(fddst); free(inherit); - if(res < 0 ){ + if (res < 0) { fprintf( stderr, "ERROR: cannot snapshot '%s' - %s\n", subvol, strerror(e)); - return 11; + return 1; } return 0;