- Exit with non-zero when fail;
- Don't exit in non-main functions, return.
Signed-off-by: WANG Cong <wangcong@zeuux.org>
in = fopen(input, "r");
if (!in) {
perror("unable to open metadump image");
- exit(1);
+ return 1;
}
}
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);
else
fclose(out);
- exit(0);
+ exit(ret);
}