a9fddb7d0124bb7dbd8737cc54f61abc6a431d2f
[openwrt.git] / toolchain / eglibc / patches / 2.9 / 100-darwin_cross.patch
1 --- a/libc/sunrpc/rpc/types.h
2 +++ b/libc/sunrpc/rpc/types.h
3 @@ -68,6 +68,7 @@ typedef unsigned long rpcport_t;
4  #include <sys/types.h>
5  #endif
6  
7 +#if !defined(_CROSS_RPCGEN_) || !defined(__APPLE__)
8  #ifndef __u_char_defined
9  typedef __u_char u_char;
10  typedef __u_short u_short;
11 @@ -83,6 +84,7 @@ typedef __daddr_t daddr_t;
12  typedef __caddr_t caddr_t;
13  # define __daddr_t_defined
14  #endif
15 +#endif
16  
17  #include <sys/time.h>
18  #include <sys/param.h>
19 --- a/libc/sunrpc/rpc_main.c
20 +++ b/libc/sunrpc/rpc_main.c
21 @@ -40,7 +40,11 @@
22  #include <stdio.h>
23  #include <string.h>
24  #include <unistd.h>
25 +#ifdef _CROSS_RPCGEN_
26 +#define gettext(X) (X)
27 +#else
28  #include <libintl.h>
29 +#endif
30  #include <ctype.h>
31  #include <sys/types.h>
32  #include <sys/param.h>
33 @@ -998,9 +1002,10 @@ mkfile_output (struct commandline *cmd)
34         abort ();
35        temp = rindex (cmd->infile, '.');
36        cp = stpcpy (mkfilename, "Makefile.");
37 -      if (temp != NULL)
38 -       *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
39 -      else
40 +      if (temp != NULL) {
41 +       strncpy (cp, cmd->infile, temp - cmd->infile);
42 +       cp[temp - cmd->infile - 1] = '\0';
43 +      } else
44         stpcpy (cp, cmd->infile);
45  
46      }
47 --- a/libc/sunrpc/rpc_scan.c
48 +++ b/libc/sunrpc/rpc_scan.c
49 @@ -39,7 +39,11 @@
50  #include <stdio.h>
51  #include <ctype.h>
52  #include <string.h>
53 +#ifdef _CROSS_RPCGEN_
54 +#define gettext(X) (X)
55 +#else
56  #include <libintl.h>
57 +#endif
58  #include "rpc_scan.h"
59  #include "rpc_parse.h"
60  #include "rpc_util.h"
61 --- a/libc/timezone/Makefile
62 +++ b/libc/timezone/Makefile
63 @@ -181,7 +181,7 @@ zic-objs = zic.o ialloc.o scheck.o
64  $(objpfx)zic: $(addprefix $(objpfx), $(zic-objs))
65  
66  $(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c
67 -       gcc $< -c $(OUTPUT_OPTION) $(CFLAGS-$*.c) $(CPPFLAGS-$*) \
68 +       gcc $< -c $(OUTPUT_OPTION) $(filter-out -DHAVE_GETTEXT,$(CFLAGS-$*.c)) $(CPPFLAGS-$*) \
69                 -DCROSS_ZIC $(compile-mkdep-flags)
70  
71  $(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs))