From: LoïMinier Date: Mon, 14 Mar 2011 07:31:42 +0000 (+0530) Subject: Add a die() macro to exit with an error message X-Git-Tag: v1.5.0~10 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=885adeea79cf0936687c91d7220321ada1dcfbad;p=pandora-x-loader.git Add a die() macro to exit with an error message Signed-off-by: LoïMinier Signed-off-by: Anand Gadiyar --- diff --git a/scripts/signGP.c b/scripts/signGP.c index ae3ddb8..d013592 100644 --- a/scripts/signGP.c +++ b/scripts/signGP.c @@ -236,6 +236,8 @@ static struct ch_chsettings_nochram config_header #endif +#define die(...) do { printf(__VA_ARGS__); exit(1); } while (0); + int main(int argc, char *argv[]) { int i; @@ -266,8 +268,7 @@ int main(int argc, char *argv[]) /* Open the input file. */ ifile = fopen(ifname, "rb"); if (ifile == NULL) { - printf("Cannot open %s\n", ifname); - return 1; + die("Cannot open %s\n", ifname); } /* Get file length. */ @@ -277,9 +278,8 @@ int main(int argc, char *argv[]) /* Open the output file and write it. */ ofile = fopen(ofname, "wb"); if (ofile == NULL) { - printf("Cannot open %s\n", ofname); fclose(ifile); - return 1; + die("Cannot open %s\n", ofname); } /* Pad 1 sector of zeroes. */