summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Cong <xiyou.wangcong@gmail.com>2009-01-21 13:22:49 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-21 13:22:49 -0500
commited62c2b0c26381770c33fbd0690d638627de511d (patch)
treebc41b5e128533fbd537b6cc70ee530f87d8bfa63
parent86179a05070d7678e7145b32cb28249d890170ba (diff)
btrfs-image.c: fix return values
- Exit with non-zero when fail; - Don't exit in non-main functions, return. Signed-off-by: WANG Cong <wangcong@zeuux.org>
-rw-r--r--btrfs-image.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 9925bdbc..62b3dd80 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);
}