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