8fe5cf3f7c233f8749982eaaaafd38b0c7532a33
[openwrt/openwrt.git] / toolchain / eglibc / patches / 2.13 / 100-fix_cross_rpcgen.patch
1 --- a/libc/sunrpc/proto.h
2 +++ b/libc/sunrpc/proto.h
3 @@ -56,12 +56,14 @@ void add_type(int len, const char *type)
4 $build's C library and $host's GLIBC. */
5 #ifdef _CROSS_RPCGEN_
6
7 +#undef stpcpy
8 +
9 /* Rather then defining _GNU_SOURCE before including $build's <string.h>
10 we just declare stpcpy here. */
11 extern char *stpcpy (char *, const char *);
12
13 -/* Use $build's i18n support as we can't use $host's. */
14 -#define _(X) (gettext (X))
15 +/* Do not use i18n support */
16 +#define _(X) (X)
17
18 /* rpcgen sources check for __GNU_LIBRARY__ to tweak for GLIBC code
19 that rpcgen generates. The proper fix would be to rename all those checks
20 --- a/libc/sunrpc/rpc/types.h
21 +++ b/libc/sunrpc/rpc/types.h
22 @@ -70,18 +70,23 @@ typedef unsigned long rpcport_t;
23 #endif
24
25 #ifndef __u_char_defined
26 -typedef __u_char u_char;
27 -typedef __u_short u_short;
28 -typedef __u_int u_int;
29 -typedef __u_long u_long;
30 -typedef __quad_t quad_t;
31 -typedef __u_quad_t u_quad_t;
32 -typedef __fsid_t fsid_t;
33 +typedef unsigned char u_char;
34 +typedef unsigned short u_short;
35 +typedef unsigned int u_int;
36 +typedef unsigned long u_long;
37 +#if __WORDSIZE == 64
38 +typedef long int quad_t;
39 +typedef unsigned long int u_quad_t;
40 +#elif defined __GLIBC_HAVE_LONG_LONG
41 +typedef long long int quad_t;
42 +typedef unsigned long long int u_quad_t;
43 +#endif
44 +typedef u_quad_t fsid_t;
45 # define __u_char_defined
46 #endif
47 -#ifndef __daddr_t_defined
48 -typedef __daddr_t daddr_t;
49 -typedef __caddr_t caddr_t;
50 +#if !defined(__daddr_t_defined) && defined(linux)
51 +typedef long int daddr_t;
52 +typedef char *caddr_t;
53 # define __daddr_t_defined
54 #endif
55
56 --- a/libc/sunrpc/rpc_main.c
57 +++ b/libc/sunrpc/rpc_main.c
58 @@ -997,9 +997,10 @@ mkfile_output (struct commandline *cmd)
59 abort ();
60 temp = rindex (cmd->infile, '.');
61 cp = stpcpy (mkfilename, "Makefile.");
62 - if (temp != NULL)
63 - *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
64 - else
65 + if (temp != NULL) {
66 + strncpy(cp, cmd->infile, temp - cmd->infile);
67 + cp[temp - cmd->infile - 1] = 0;
68 + } else
69 stpcpy (cp, cmd->infile);
70
71 }