summaryrefslogtreecommitdiff
path: root/multilib-testing/lib32-glibc/glibc-2.16-rpcgen-cpp-path.patch
blob: 822b57294b3ae82be152683af85da850be82fd8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index 06d951a..2103b10 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -75,12 +75,9 @@ struct commandline
 
 static const char *cmdname;
 
-#define SVR4_CPP "/usr/ccs/lib/cpp"
-#define SUNOS_CPP "/lib/cpp"
-
 static const char *svcclosetime = "120";
 static int cppDefined;	/* explicit path for C preprocessor */
-static const char *CPP = SUNOS_CPP;
+static const char *CPP = "/lib/cpp";
 static const char CPPFLAGS[] = "-C";
 static char *pathbuf;
 static int cpp_pid;
@@ -327,23 +324,17 @@ find_cpp (void)
 {
   struct stat buf;
 
-  if (stat (CPP, &buf) < 0)
-    {				/* /lib/cpp or explicit cpp does not exist */
-      if (cppDefined)
-	{
-	  fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
-	  crash ();
-	}
-      else
-	{			/* try the other one */
-	  CPP = SVR4_CPP;
-	  if (stat (CPP, &buf) < 0)
-	    {			/* can't find any cpp */
-	      fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
-	      crash ();
-	    }
-	}
+  if (stat (CPP, &buf) == 0)
+    return;
+
+  if (cppDefined) /* user specified cpp but it does not exist */
+    {
+      fprintf (stderr, _ ("cannot find C preprocessor: %s\n"), CPP);
+      crash ();
     }
+
+  /* fall back to system CPP */
+  CPP = "cpp";
 }
 
 /*
@@ -374,8 +365,13 @@ open_input (const char *infile, const char *define)
       close (1);
       dup2 (pd[1], 1);
       close (pd[0]);
-      execv (arglist[0], (char **) arglist);
-      perror ("execv");
+      execvp (arglist[0], (char **) arglist);
+      if (errno == ENOENT)
+        {
+          fprintf (stderr, _ ("cannot find C preprocessor: %s\n"), CPP);
+          exit (1);
+        }
+      perror ("execvp");
       exit (1);
     case -1:
       perror ("fork");