From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Cc: sandeen@redhat.com
Subject: [PATCH v2 8/16] btrfs-progs: fix resource leak in scrub_start()
Date: Thu, 12 Dec 2013 15:34:16 +0800 [thread overview]
Message-ID: <1386833656-32217-1-git-send-email-wangsl.fnst@cn.fujitsu.com> (raw)
From: Eric Sandeen <sandeen@redhat.com>
Resolves-Coverity-CID: 1125934
Resolves-Coverity-CID: 1125935
Resolves-Coverity-CID: 1125936
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
v1->v2:
make sure we are returning right value
---
cmds-scrub.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmds-scrub.c b/cmds-scrub.c
index 605af45..b36e2b1 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -1096,6 +1096,7 @@ static int scrub_start(int argc, char **argv, int resume)
void *terr;
u64 devid;
DIR *dirstream = NULL;
+ int nothing_to_resume = 0;
optind = 1;
while ((c = getopt(argc, argv, "BdqrRc:n:")) != -1) {
@@ -1261,7 +1262,8 @@ static int scrub_start(int argc, char **argv, int resume)
if (!do_quiet)
printf("scrub: nothing to resume for %s, fsid %s\n",
path, fsid);
- return 2;
+ nothing_to_resume = 1;
+ goto out;
}
ret = prg_fd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -1497,6 +1499,8 @@ out:
}
close_file_or_dir(fdmnt, dirstream);
+ if (nothing_to_resume)
+ return 2;
if (err)
return 1;
if (e_correctable)
--
1.8.3.1
reply other threads:[~2013-12-12 7:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386833656-32217-1-git-send-email-wangsl.fnst@cn.fujitsu.com \
--to=wangsl.fnst@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).