From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: [Patch] btrfs-image.c: fix return values
Date: Mon, 19 Jan 2009 19:27:39 +0800 [thread overview]
Message-ID: <20090119112739.GB4867@hack.private> (raw)
- Exit with non-zero when fail;
- Don't exit in non-main functions, return.
Signed-off-by: WANG Cong <wangcong@zeuux.org>
---
diff --git a/btrfs-image.c b/btrfs-image.c
index 9925bdb..62b3dd8 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -741,7 +741,7 @@ static int restore_metadump(const char *input, FILE *out, int num_threads)
in = fopen(input, "r");
if (!in) {
perror("unable to open metadump image");
- exit(1);
+ return 1;
}
}
@@ -760,7 +760,7 @@ static int restore_metadump(const char *input, FILE *out, int num_threads)
if (le64_to_cpu(header->magic) != HEADER_MAGIC ||
le64_to_cpu(header->bytenr) != bytenr) {
fprintf(stderr, "bad header in metadump image\n");
- exit(1);
+ return 1;
}
ret = add_cluster(cluster, &mdrestore, &bytenr);
BUG_ON(ret);
@@ -850,5 +850,5 @@ int main(int argc, char *argv[])
else
fclose(out);
- exit(0);
+ exit(ret);
}
reply other threads:[~2009-01-19 11:27 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=20090119112739.GB4867@hack.private \
--to=xiyou.wangcong@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/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