toolchain: The glorious return of glibc, ver 2.21
[openwrt/openwrt.git] / toolchain / glibc / patches / 2.21 / 100-fix_cross_rpcgen.patch
1 --- a/sunrpc/rpc/types.h
2 +++ b/sunrpc/rpc/types.h
3 @@ -75,18 +75,23 @@ typedef unsigned long rpcport_t;
4 #endif
5
6 #ifndef __u_char_defined
7 -typedef __u_char u_char;
8 -typedef __u_short u_short;
9 -typedef __u_int u_int;
10 -typedef __u_long u_long;
11 -typedef __quad_t quad_t;
12 -typedef __u_quad_t u_quad_t;
13 -typedef __fsid_t fsid_t;
14 +typedef unsigned char u_char;
15 +typedef unsigned short u_short;
16 +typedef unsigned int u_int;
17 +typedef unsigned long u_long;
18 +#if __WORDSIZE == 64
19 +typedef long int quad_t;
20 +typedef unsigned long int u_quad_t;
21 +#elif defined __GLIBC_HAVE_LONG_LONG
22 +typedef long long int quad_t;
23 +typedef unsigned long long int u_quad_t;
24 +#endif
25 +typedef u_quad_t fsid_t;
26 # define __u_char_defined
27 #endif
28 -#ifndef __daddr_t_defined
29 -typedef __daddr_t daddr_t;
30 -typedef __caddr_t caddr_t;
31 +#if !defined(__daddr_t_defined) && defined(linux)
32 +typedef long int daddr_t;
33 +typedef char *caddr_t;
34 # define __daddr_t_defined
35 #endif
36
37 --- a/sunrpc/rpc_main.c
38 +++ b/sunrpc/rpc_main.c
39 @@ -958,9 +958,10 @@ mkfile_output (struct commandline *cmd)
40 abort ();
41 temp = rindex (cmd->infile, '.');
42 cp = stpcpy (mkfilename, "Makefile.");
43 - if (temp != NULL)
44 - *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
45 - else
46 + if (temp != NULL) {
47 + strncpy(cp, cmd->infile, temp - cmd->infile);
48 + cp[temp - cmd->infile - 1] = 0;
49 + } else
50 stpcpy (cp, cmd->infile);
51
52 }