]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rxgen: Error out if cpp exits with error
authorAndrew Deason <adeason@sinenomine.net>
Wed, 4 Aug 2010 16:19:35 +0000 (11:19 -0500)
committerDerrick Brashear <shadow@dementia.org>
Fri, 6 Aug 2010 04:12:42 +0000 (21:12 -0700)
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>
src/rxgen/rpc_main.c

index 5c02c16d22f457d20dce0f89cc9a2b65e7d0b328..37d2a8aae523ebc322395443e0501394cfae54dc 100644 (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) {