rxgen: Error out if cpp exits with error

If we call 'cpp' and it returns with an erroneous exit code, exit with
an error ourselves. Otherwise we will return success and generate
empty results even if the input file is unreadable, for instance,
which causes confusing errors later in the build.

Change-Id: Ia12dc58eee0937a6bd529dcd6b552e253dbc40c8
Reviewed-on: http://gerrit.openafs.org/2519
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Andrew Deason 2010-08-04 11:19:35 -05:00 committed by Derrick Brashear
parent a4267ef140
commit b832cdc1c7

View File

@ -91,6 +91,7 @@ char zflag = 0; /* If set, abort server stub if rpc call returns non-zero */
char xflag = 0; /* if set, add stats code to stubs */
char yflag = 0; /* if set, only emit function name arrays to xdr file */
int debug = 0;
static int pclose_fin = 0;
static char *cmdname;
#ifdef AFS_NT40_ENV
static char *CPP = NULL;
@ -223,6 +224,12 @@ main(int argc, char *argv[])
reinitialize();
}
}
if (fin && pclose_fin) {
/* the cpp command we called returned a non-zero exit status */
if (pclose(fin)) {
crash();
}
}
exit(0);
}
@ -313,6 +320,7 @@ open_input(char *infile, char *define)
fin = popen(cpp_cmdline, "r");
if (fin == NULL)
perror("popen");
pclose_fin = 1;
} else {
if (infile == NULL) {