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>
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;
reinitialize();
}
}
+ if (fin && pclose_fin) {
+ /* the cpp command we called returned a non-zero exit status */
+ if (pclose(fin)) {
+ crash();
+ }
+ }
exit(0);
}
fin = popen(cpp_cmdline, "r");
if (fin == NULL)
perror("popen");
+ pclose_fin = 1;
} else {
if (infile == NULL) {