Contents of /trunk/mkinitrd/patches/mkinitrd-6.3.5-klibc-1.5.22.patch
Parent Directory | Revision Log
Revision 1730 -
(show annotations)
(download)
Wed Apr 4 08:05:16 2012 UTC (12 years, 5 months ago) by niro
File size: 48224 byte(s)
Wed Apr 4 08:05:16 2012 UTC (12 years, 5 months ago) by niro
File size: 48224 byte(s)
-update to klibc-1.5.22
1 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/klcc/klcc.in mkinitrd-magellan/klibc/klcc/klcc.in |
2 | --- ../tags/mkinitrd-6_3_5/klibc/klcc/klcc.in 2011-11-24 01:38:55.000000000 +0100 |
3 | +++ mkinitrd-magellan/klibc/klcc/klcc.in 2011-11-24 01:44:48.000000000 +0100 |
4 | @@ -159,6 +159,9 @@ |
5 | # gcc options, that force preprocessing mode |
6 | push(@ccopt, $a); |
7 | $operation = 'E'; |
8 | + } elsif ( $a eq '--param' ) { |
9 | + push(@ccopt, $a); |
10 | + push(@ccopt, shift(@ARGV)); |
11 | } elsif ( $a =~ /^-[gp]/ || $a eq '-p' ) { |
12 | # Debugging options to gcc |
13 | push(@ccopt, $a); |
14 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/klibc.spec mkinitrd-magellan/klibc/klibc.spec |
15 | --- ../tags/mkinitrd-6_3_5/klibc/klibc.spec 2011-11-24 01:38:54.000000000 +0100 |
16 | +++ mkinitrd-magellan/klibc/klibc.spec 2011-11-24 01:44:48.000000000 +0100 |
17 | @@ -1,6 +1,6 @@ |
18 | Summary: A minimal libc subset for use with initramfs. |
19 | Name: klibc |
20 | -Version: 1.5.19 |
21 | +Version: 1.5.22 |
22 | Release: 1 |
23 | License: BSD/GPL |
24 | Group: Development/Libraries |
25 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/Makefile mkinitrd-magellan/klibc/Makefile |
26 | --- ../tags/mkinitrd-6_3_5/klibc/Makefile 2011-11-24 01:38:55.000000000 +0100 |
27 | +++ mkinitrd-magellan/klibc/Makefile 2011-11-24 01:44:48.000000000 +0100 |
28 | @@ -91,7 +91,7 @@ |
29 | .PHONY: all klcc klibc |
30 | all: klcc klibc |
31 | |
32 | -$(objtree)/.config: $(srctree)/defconfig $(KLIBCKERNELOBJ) |
33 | +$(objtree)/.config: $(srctree)/defconfig |
34 | @echo "defconfig has changed, please remove or edit .config" |
35 | @false |
36 | |
37 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/scripts/basic/fixdep.c mkinitrd-magellan/klibc/scripts/basic/fixdep.c |
38 | --- ../tags/mkinitrd-6_3_5/klibc/scripts/basic/fixdep.c 2011-11-24 01:38:54.000000000 +0100 |
39 | +++ mkinitrd-magellan/klibc/scripts/basic/fixdep.c 2011-11-24 01:44:48.000000000 +0100 |
40 | @@ -364,10 +364,11 @@ |
41 | void traps(void) |
42 | { |
43 | static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; |
44 | + int *p = (int *)test; |
45 | |
46 | - if (*(int *)test != INT_CONF) { |
47 | + if (*p != INT_CONF) { |
48 | fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n", |
49 | - *(int *)test); |
50 | + *p); |
51 | exit(2); |
52 | } |
53 | } |
54 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/scripts/Kbuild.klibc mkinitrd-magellan/klibc/scripts/Kbuild.klibc |
55 | --- ../tags/mkinitrd-6_3_5/klibc/scripts/Kbuild.klibc 2011-11-24 01:38:55.000000000 +0100 |
56 | +++ mkinitrd-magellan/klibc/scripts/Kbuild.klibc 2011-11-24 01:44:48.000000000 +0100 |
57 | @@ -93,11 +93,16 @@ |
58 | KLIBCLD := $(LD) |
59 | KLIBCCC := $(CC) |
60 | KLIBCAR := $(AR) |
61 | -KLIBCRANLIB := $(RANLIB) |
62 | + |
63 | +# klibc-ar is a macro that invokes KLIBCAR and takes 2 arguments of ar commands. |
64 | +# The second will be used for reproducible builds, the first otherwise. |
65 | +klibc-ar = $(KLIBCAR) $(if $(KBUILD_REPRODUCIBLE),$(2),$(1)) |
66 | + |
67 | +KLIBCRANLIB := $(call klibc-ar,s,Ds) |
68 | KLIBCSTRIP := $(STRIP) |
69 | KLIBCNM := $(NM) |
70 | -KLIBCOBJCOPY := $(OBJCOPY) |
71 | -KLIBCOBJDUMP := $(OBJDUMP) |
72 | +KLIBCOBJCOPY := $(OBJCOPY) |
73 | +KLIBCOBJDUMP := $(OBJDUMP) |
74 | |
75 | # klibc include paths |
76 | KLIBCCPPFLAGS := -nostdinc -iwithprefix include \ |
77 | @@ -265,8 +270,8 @@ |
78 | quiet_cmd_link_o_target = LD $@ |
79 | # If the list of objects to link is empty, just create an empty lib.a |
80 | cmd_link_o_target = $(if $(strip $(lib-y)),\ |
81 | - rm -f $@; $(KLIBCAR) cru $@ $(filter $(lib-y), $^),\ |
82 | - rm -f $@; $(KLIBCAR) crs $@) |
83 | + rm -f $@; $(call klibc-ar,cru,Dcr) $@ $(filter $(lib-y), $^),\ |
84 | + rm -f $@; $(call klibc-ar,crs,Dcrs) $@) |
85 | |
86 | $(lib-target): $(lib-y) FORCE |
87 | $(call if_changed,link_o_target) |
88 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/scripts/Makefile.host mkinitrd-magellan/klibc/scripts/Makefile.host |
89 | --- ../tags/mkinitrd-6_3_5/klibc/scripts/Makefile.host 2011-11-24 01:38:54.000000000 +0100 |
90 | +++ mkinitrd-magellan/klibc/scripts/Makefile.host 2011-11-24 01:44:48.000000000 +0100 |
91 | @@ -5,7 +5,7 @@ |
92 | # |
93 | # Both C and C++ is supported, but preferred language is C for such utilities. |
94 | # |
95 | -# Samle syntax (see Documentation/kbuild/makefile.txt for reference) |
96 | +# Sample syntax (see Documentation/kbuild/makefile.txt for reference) |
97 | # hostprogs-y := bin2hex |
98 | # Will compile bin2hex.c and create an executable named bin2hex |
99 | # |
100 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/arm/klibc/archconfig.h mkinitrd-magellan/klibc/usr/include/arch/arm/klibc/archconfig.h |
101 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/arm/klibc/archconfig.h 2011-11-24 01:38:47.000000000 +0100 |
102 | +++ mkinitrd-magellan/klibc/usr/include/arch/arm/klibc/archconfig.h 2011-11-24 01:44:45.000000000 +0100 |
103 | @@ -9,6 +9,10 @@ |
104 | #ifndef _KLIBC_ARCHCONFIG_H |
105 | #define _KLIBC_ARCHCONFIG_H |
106 | |
107 | -/* All defaults */ |
108 | +/* newer arm arch support bx instruction */ |
109 | +#if (!defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_3__) \ |
110 | + && !defined(__ARM_ARCH_3M__) && !defined(__ARM_ARCH_4__)) |
111 | +# define _KLIBC_ARM_USE_BX 1 |
112 | +#endif |
113 | |
114 | #endif /* _KLIBC_ARCHCONFIG_H */ |
115 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/arm/klibc/asmmacros.h mkinitrd-magellan/klibc/usr/include/arch/arm/klibc/asmmacros.h |
116 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/arm/klibc/asmmacros.h 2011-11-24 01:38:47.000000000 +0100 |
117 | +++ mkinitrd-magellan/klibc/usr/include/arch/arm/klibc/asmmacros.h 2011-11-24 01:44:45.000000000 +0100 |
118 | @@ -7,24 +7,10 @@ |
119 | #ifndef _KLIBC_ASMMACROS_H |
120 | #define _KLIBC_ASMMACROS_H |
121 | |
122 | -/* An immediate in ARM can be any 8-bit value rotated by an even number of bits */ |
123 | - |
124 | -#define ARM_VALID_IMM(x) \ |
125 | - ((((x) & ~0x000000ff) == 0) || \ |
126 | - (((x) & ~0x000003fc) == 0) || \ |
127 | - (((x) & ~0x00000ff0) == 0) || \ |
128 | - (((x) & ~0x00003fc0) == 0) || \ |
129 | - (((x) & ~0x0000ff00) == 0) || \ |
130 | - (((x) & ~0x0003fc00) == 0) || \ |
131 | - (((x) & ~0x000ff000) == 0) || \ |
132 | - (((x) & ~0x003fc000) == 0) || \ |
133 | - (((x) & ~0x00ff0000) == 0) || \ |
134 | - (((x) & ~0x03fc0000) == 0) || \ |
135 | - (((x) & ~0x0ff00000) == 0) || \ |
136 | - (((x) & ~0x3fc00000) == 0) || \ |
137 | - (((x) & ~0xff000000) == 0) || \ |
138 | - (((x) & ~0xfc000003) == 0) || \ |
139 | - (((x) & ~0xf000000f) == 0) || \ |
140 | - (((x) & ~0xc000003f) == 0)) |
141 | +#if _KLIBC_ARM_USE_BX |
142 | +# define BX(x) bx x |
143 | +#else |
144 | +# define BX(x) mov pc, x |
145 | +#endif |
146 | |
147 | #endif /* _KLIBC_ASMMACROS_H */ |
148 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/i386/klibc/archconfig.h mkinitrd-magellan/klibc/usr/include/arch/i386/klibc/archconfig.h |
149 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/arch/i386/klibc/archconfig.h 2011-11-24 01:38:47.000000000 +0100 |
150 | +++ mkinitrd-magellan/klibc/usr/include/arch/i386/klibc/archconfig.h 2011-11-24 01:44:45.000000000 +0100 |
151 | @@ -9,7 +9,7 @@ |
152 | #ifndef _KLIBC_ARCHCONFIG_H |
153 | #define _KLIBC_ARCHCONFIG_H |
154 | |
155 | -/* On i386, only half the signals are accessible using the legacy calls. */ |
156 | -#define _KLIBC_USE_RT_SIG 1 |
157 | +/* The i386 <asm/signal.h> is still not clean enough for this... */ |
158 | +#define _KLIBC_USE_RT_SIG 0 |
159 | |
160 | #endif /* _KLIBC_ARCHCONFIG_H */ |
161 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/ctype.h mkinitrd-magellan/klibc/usr/include/ctype.h |
162 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/ctype.h 2011-11-24 01:38:49.000000000 +0100 |
163 | +++ mkinitrd-magellan/klibc/usr/include/ctype.h 2011-11-24 01:44:46.000000000 +0100 |
164 | @@ -133,7 +133,7 @@ |
165 | __extern int X(int); |
166 | #else |
167 | #define __CTYPEFUNC(X) \ |
168 | - __extern inline int X(int __c) \ |
169 | + __extern_inline int X(int __c) \ |
170 | { \ |
171 | return __ctype_##X(__c); \ |
172 | } |
173 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/klibc/compiler.h mkinitrd-magellan/klibc/usr/include/klibc/compiler.h |
174 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/klibc/compiler.h 2011-11-24 01:38:49.000000000 +0100 |
175 | +++ mkinitrd-magellan/klibc/usr/include/klibc/compiler.h 2011-11-24 01:44:46.000000000 +0100 |
176 | @@ -20,16 +20,38 @@ |
177 | # define __cdecl /* Meaningless on non-i386 */ |
178 | #endif |
179 | |
180 | +/* |
181 | + * How to declare a function which should be inlined or instantiated locally |
182 | + */ |
183 | +#ifdef __GNUC__ |
184 | +# ifdef __GNUC_STDC_INLINE__ |
185 | +# define __static_inline static __inline__ __attribute__((__gnu_inline__)) |
186 | +# else |
187 | +# define __static_inline static __inline__ |
188 | +# endif |
189 | +#else |
190 | +# define __static_inline inline /* Just hope this works... */ |
191 | +#endif |
192 | + |
193 | +/* |
194 | + * How to declare a function which should be inlined or have a call to |
195 | + * an external module |
196 | + */ |
197 | +#ifdef __GNUC__ |
198 | +# ifdef __GNUC_STDC_INLINE__ |
199 | +# define __extern_inline extern __inline__ __attribute__((__gnu_inline__)) |
200 | +# else |
201 | +# define __extern_inline extern __inline__ |
202 | +# endif |
203 | +#else |
204 | +# define __extern_inline inline /* Just hope this works... */ |
205 | +#endif |
206 | + |
207 | /* How to declare a function that *must* be inlined */ |
208 | /* Use "extern inline" even in the gcc3+ case to avoid warnings in ctype.h */ |
209 | #ifdef __GNUC__ |
210 | # if __GNUC__ >= 3 |
211 | -# ifdef __GNUC_STDC_INLINE__ |
212 | -# define __must_inline extern __inline__ \ |
213 | - __attribute__((__gnu_inline__,__always_inline__)) |
214 | -# else |
215 | -# define __must_inline extern __inline__ __attribute__((__always_inline__)) |
216 | -# endif |
217 | +# define __must_inline __extern_inline __attribute__((__always_inline__)) |
218 | # else |
219 | # define __must_inline extern __inline__ |
220 | # endif |
221 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/klibc/sysconfig.h mkinitrd-magellan/klibc/usr/include/klibc/sysconfig.h |
222 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/klibc/sysconfig.h 2011-11-24 01:38:49.000000000 +0100 |
223 | +++ mkinitrd-magellan/klibc/usr/include/klibc/sysconfig.h 2011-11-24 01:44:46.000000000 +0100 |
224 | @@ -169,7 +169,7 @@ |
225 | * |
226 | * mips has it's own definition of statfs, which is |
227 | * different from any other 32 bit arch. |
228 | - */ |
229 | + */ |
230 | #ifndef _KLIBC_STATFS_F_TYPE_32B |
231 | # define _KLIBC_STATFS_F_TYPE_32B 0 |
232 | #endif |
233 | @@ -196,4 +196,13 @@ |
234 | # define _KLIBC_SYS_SOCKETCALL 0 |
235 | #endif |
236 | |
237 | +/* |
238 | + * _KLIBC_ARM_USE_BX |
239 | + * |
240 | + * This arm architecture supports bx instruction. |
241 | + */ |
242 | +#ifndef _KLIBC_ARM_USE_BX |
243 | +# define _KLIBC_ARM_USE_BX 0 |
244 | +#endif |
245 | + |
246 | #endif /* _KLIBC_SYSCONFIG_H */ |
247 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/stdio.h mkinitrd-magellan/klibc/usr/include/stdio.h |
248 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/stdio.h 2011-11-24 01:38:49.000000000 +0100 |
249 | +++ mkinitrd-magellan/klibc/usr/include/stdio.h 2011-11-24 01:44:45.000000000 +0100 |
250 | @@ -49,22 +49,22 @@ |
251 | |
252 | __extern FILE *fopen(const char *, const char *); |
253 | |
254 | -static __inline__ FILE *fdopen(int __fd, const char *__m) |
255 | +__static_inline FILE *fdopen(int __fd, const char *__m) |
256 | { |
257 | (void)__m; |
258 | return __create_file(__fd); |
259 | } |
260 | -static __inline__ int fclose(FILE * __f) |
261 | +__static_inline int fclose(FILE * __f) |
262 | { |
263 | extern int close(int); |
264 | return close(fileno(__f)); |
265 | } |
266 | -static __inline__ int fseek(FILE * __f, off_t __o, int __w) |
267 | +__static_inline int fseek(FILE * __f, off_t __o, int __w) |
268 | { |
269 | extern off_t lseek(int, off_t, int); |
270 | return (lseek(fileno(__f), __o, __w) == (off_t) - 1) ? -1 : 0; |
271 | } |
272 | -static __inline__ off_t ftell(FILE * __f) |
273 | +__static_inline off_t ftell(FILE * __f) |
274 | { |
275 | extern off_t lseek(int, off_t, int); |
276 | return lseek(fileno(__f), 0, SEEK_CUR); |
277 | @@ -85,12 +85,13 @@ |
278 | __extern size_t _fwrite(const void *, size_t, FILE *); |
279 | |
280 | #ifndef __NO_FREAD_FWRITE_INLINES |
281 | -extern __inline__ size_t fread(void *__p, size_t __s, size_t __n, FILE * __f) |
282 | +__extern_inline size_t |
283 | +fread(void *__p, size_t __s, size_t __n, FILE * __f) |
284 | { |
285 | return _fread(__p, __s * __n, __f) / __s; |
286 | } |
287 | |
288 | -extern __inline__ size_t |
289 | +__extern_inline size_t |
290 | fwrite(const void *__p, size_t __s, size_t __n, FILE * __f) |
291 | { |
292 | return _fwrite(__p, __s * __n, __f) / __s; |
293 | @@ -109,14 +110,14 @@ |
294 | __extern int vasprintf(char **, const char *, va_list); |
295 | |
296 | /* No buffering, so no flushing needed */ |
297 | -static __inline__ int fflush(FILE * __f) |
298 | +__static_inline int fflush(FILE * __f) |
299 | { |
300 | (void)__f; |
301 | return 0; |
302 | } |
303 | |
304 | /* stream errors are not kept track of by klibc implementation */ |
305 | -static __inline__ int ferror(FILE * __f) |
306 | +__static_inline int ferror(FILE * __f) |
307 | { |
308 | (void)__f; |
309 | return 0; |
310 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/include/sys/socket.h mkinitrd-magellan/klibc/usr/include/sys/socket.h |
311 | --- ../tags/mkinitrd-6_3_5/klibc/usr/include/sys/socket.h 2011-11-24 01:38:49.000000000 +0100 |
312 | +++ mkinitrd-magellan/klibc/usr/include/sys/socket.h 2011-11-24 01:44:46.000000000 +0100 |
313 | @@ -5,6 +5,7 @@ |
314 | #ifndef _SYS_SOCKET_H |
315 | #define _SYS_SOCKET_H |
316 | |
317 | +#include <sys/types.h> |
318 | #include <klibc/extern.h> |
319 | #include <klibc/compiler.h> |
320 | #include <klibc/sysconfig.h> |
321 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/do_mounts.c mkinitrd-magellan/klibc/usr/kinit/do_mounts.c |
322 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/do_mounts.c 2011-11-24 01:38:47.000000000 +0100 |
323 | +++ mkinitrd-magellan/klibc/usr/kinit/do_mounts.c 2011-11-24 01:44:45.000000000 +0100 |
324 | @@ -1,4 +1,3 @@ |
325 | -#include <ctype.h> |
326 | #include <errno.h> |
327 | #include <fcntl.h> |
328 | #include <sys/mount.h> |
329 | @@ -7,7 +6,6 @@ |
330 | #include <stdlib.h> |
331 | #include <string.h> |
332 | #include <unistd.h> |
333 | -#include <alloca.h> |
334 | #include <inttypes.h> |
335 | |
336 | #include "do_mounts.h" |
337 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/do_mounts_md.c mkinitrd-magellan/klibc/usr/kinit/do_mounts_md.c |
338 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/do_mounts_md.c 2011-11-24 01:38:46.000000000 +0100 |
339 | +++ mkinitrd-magellan/klibc/usr/kinit/do_mounts_md.c 2011-11-24 01:44:45.000000000 +0100 |
340 | @@ -14,7 +14,6 @@ |
341 | #include <stdlib.h> |
342 | #include <string.h> |
343 | #include <unistd.h> |
344 | -#include <alloca.h> |
345 | #include <inttypes.h> |
346 | #include <sys/sysmacros.h> |
347 | #include <sys/md.h> |
348 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/fstype/main.c mkinitrd-magellan/klibc/usr/kinit/fstype/main.c |
349 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/fstype/main.c 2011-11-24 01:38:47.000000000 +0100 |
350 | +++ mkinitrd-magellan/klibc/usr/kinit/fstype/main.c 2011-11-24 01:44:45.000000000 +0100 |
351 | @@ -16,7 +16,6 @@ |
352 | #include <fcntl.h> |
353 | #include <unistd.h> |
354 | #include <string.h> |
355 | -#include <errno.h> |
356 | #include <stdlib.h> |
357 | #include "fstype.h" |
358 | |
359 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/fstype/reiser4_fs.h mkinitrd-magellan/klibc/usr/kinit/fstype/reiser4_fs.h |
360 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/fstype/reiser4_fs.h 2011-11-24 01:38:47.000000000 +0100 |
361 | +++ mkinitrd-magellan/klibc/usr/kinit/fstype/reiser4_fs.h 2011-11-24 01:44:45.000000000 +0100 |
362 | @@ -8,7 +8,7 @@ |
363 | * Master super block structure. It is the same for all reiser4 filesystems, |
364 | * so, we can declare it here. It contains common for all format fields like |
365 | * block size etc. |
366 | - */ |
367 | + */ |
368 | struct reiser4_master_sb { |
369 | /* Master super block magic. */ |
370 | char ms_magic[SS_MAGIC_SIZE]; |
371 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/bootp_proto.c mkinitrd-magellan/klibc/usr/kinit/ipconfig/bootp_proto.c |
372 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/bootp_proto.c 2011-11-24 01:38:46.000000000 +0100 |
373 | +++ mkinitrd-magellan/klibc/usr/kinit/ipconfig/bootp_proto.c 2011-11-24 01:44:45.000000000 +0100 |
374 | @@ -169,9 +169,9 @@ |
375 | }; |
376 | int ret; |
377 | |
378 | - ret = packet_recv(iov, 3); |
379 | + ret = packet_recv(dev, iov, 3); |
380 | if (ret <= 0) |
381 | - return -1; |
382 | + return ret; |
383 | |
384 | if (ret < sizeof(struct bootp_hdr) || |
385 | bootp.op != BOOTP_REPLY || /* RFC951 7.5 */ |
386 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/dhcp_proto.c mkinitrd-magellan/klibc/usr/kinit/ipconfig/dhcp_proto.c |
387 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/dhcp_proto.c 2011-11-24 01:38:46.000000000 +0100 |
388 | +++ mkinitrd-magellan/klibc/usr/kinit/ipconfig/dhcp_proto.c 2011-11-24 01:44:45.000000000 +0100 |
389 | @@ -147,9 +147,9 @@ |
390 | }; |
391 | int ret; |
392 | |
393 | - ret = packet_recv(iov, 3); |
394 | - if (ret == 0) |
395 | - return -1; |
396 | + ret = packet_recv(dev, iov, 3); |
397 | + if (ret <= 0) |
398 | + return ret; |
399 | |
400 | dprintf("\n dhcp xid %08x ", dev->bootp.xid); |
401 | |
402 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/main.c mkinitrd-magellan/klibc/usr/kinit/ipconfig/main.c |
403 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/main.c 2011-11-24 01:38:47.000000000 +0100 |
404 | +++ mkinitrd-magellan/klibc/usr/kinit/ipconfig/main.c 2011-11-24 01:44:45.000000000 +0100 |
405 | @@ -1,4 +1,3 @@ |
406 | -#include <errno.h> |
407 | #include <poll.h> |
408 | #include <limits.h> |
409 | #include <setjmp.h> |
410 | @@ -96,6 +95,30 @@ |
411 | dev->hostname, dev->name); |
412 | } |
413 | |
414 | +/* |
415 | + * Escape shell varialbes in git style: |
416 | + * Always start with a single quote ('), then leave all characters |
417 | + * except ' and ! unchanged. |
418 | + */ |
419 | +static void write_option(FILE* f, const char* name, const char* chr) |
420 | +{ |
421 | + |
422 | + fprintf(f, "%s='", name); |
423 | + while (*chr) { |
424 | + switch (*chr) { |
425 | + case '!': |
426 | + case '\'': |
427 | + fprintf(f, "'\\%c'", *chr); |
428 | + break; |
429 | + default: |
430 | + fprintf(f, "%c", *chr); |
431 | + break; |
432 | + } |
433 | + ++chr; |
434 | + } |
435 | + fprintf(f, "'\n"); |
436 | +} |
437 | + |
438 | static void dump_device_config(struct netdev *dev) |
439 | { |
440 | char fn[40]; |
441 | @@ -104,22 +127,26 @@ |
442 | snprintf(fn, sizeof(fn), "/tmp/net-%s.conf", dev->name); |
443 | f = fopen(fn, "w"); |
444 | if (f) { |
445 | - fprintf(f, "DEVICE=%s\n", dev->name); |
446 | - fprintf(f, "IPV4ADDR=%s\n", my_inet_ntoa(dev->ip_addr)); |
447 | - fprintf(f, "IPV4BROADCAST=%s\n", |
448 | - my_inet_ntoa(dev->ip_broadcast)); |
449 | - fprintf(f, "IPV4NETMASK=%s\n", my_inet_ntoa(dev->ip_netmask)); |
450 | - fprintf(f, "IPV4GATEWAY=%s\n", my_inet_ntoa(dev->ip_gateway)); |
451 | - fprintf(f, "IPV4DNS0=%s\n", |
452 | - my_inet_ntoa(dev->ip_nameserver[0])); |
453 | - fprintf(f, "IPV4DNS1=%s\n", |
454 | - my_inet_ntoa(dev->ip_nameserver[1])); |
455 | - fprintf(f, "HOSTNAME=%s\n", dev->hostname); |
456 | - fprintf(f, "DNSDOMAIN=%s\n", dev->dnsdomainname); |
457 | - fprintf(f, "NISDOMAIN=%s\n", dev->nisdomainname); |
458 | - fprintf(f, "ROOTSERVER=%s\n", my_inet_ntoa(dev->ip_server)); |
459 | - fprintf(f, "ROOTPATH=%s\n", dev->bootpath); |
460 | - fprintf(f, "filename=\"%s\"\n", dev->filename); |
461 | + write_option(f, "DEVICE", dev->name); |
462 | + write_option(f, "IPV4ADDR", |
463 | + my_inet_ntoa(dev->ip_addr)); |
464 | + write_option(f, "IPV4BROADCAST", |
465 | + my_inet_ntoa(dev->ip_broadcast)); |
466 | + write_option(f, "IPV4NETMASK", |
467 | + my_inet_ntoa(dev->ip_netmask)); |
468 | + write_option(f, "IPV4GATEWAY", |
469 | + my_inet_ntoa(dev->ip_gateway)); |
470 | + write_option(f, "IPV4DNS0", |
471 | + my_inet_ntoa(dev->ip_nameserver[0])); |
472 | + write_option(f, "IPV4DNS1", |
473 | + my_inet_ntoa(dev->ip_nameserver[1])); |
474 | + write_option(f, "HOSTNAME", dev->hostname); |
475 | + write_option(f, "DNSDOMAIN", dev->dnsdomainname); |
476 | + write_option(f, "NISDOMAIN", dev->nisdomainname); |
477 | + write_option(f, "ROOTSERVER", |
478 | + my_inet_ntoa(dev->ip_server)); |
479 | + write_option(f, "ROOTPATH", dev->bootpath); |
480 | + write_option(f, "filename", dev->filename); |
481 | fclose(f); |
482 | } |
483 | } |
484 | @@ -171,7 +198,7 @@ |
485 | |
486 | /* |
487 | * Returns: |
488 | - * 0 = Not handled, the packet is still in the queue |
489 | + * 0 = Not handled, try again later |
490 | * 1 = Handled |
491 | */ |
492 | static int process_receive_event(struct state *s, time_t now) |
493 | @@ -179,12 +206,20 @@ |
494 | int handled = 1; |
495 | |
496 | switch (s->state) { |
497 | + case DEVST_ERROR: |
498 | + return 0; /* Not handled */ |
499 | + case DEVST_COMPLETE: |
500 | + return 0; /* Not handled as already configured */ |
501 | + |
502 | case DEVST_BOOTP: |
503 | s->restart_state = DEVST_BOOTP; |
504 | switch (bootp_recv_reply(s->dev)) { |
505 | case -1: |
506 | s->state = DEVST_ERROR; |
507 | break; |
508 | + case 0: |
509 | + handled = 0; |
510 | + break; |
511 | case 1: |
512 | s->state = DEVST_COMPLETE; |
513 | dprintf("\n bootp reply\n"); |
514 | @@ -198,6 +233,9 @@ |
515 | case -1: |
516 | s->state = DEVST_ERROR; |
517 | break; |
518 | + case 0: |
519 | + handled = 0; |
520 | + break; |
521 | case DHCPOFFER: /* Offer received */ |
522 | s->state = DEVST_DHCPREQ; |
523 | dhcp_send_request(s->dev); |
524 | @@ -211,6 +249,9 @@ |
525 | case -1: /* error */ |
526 | s->state = DEVST_ERROR; |
527 | break; |
528 | + case 0: |
529 | + handled = 0; |
530 | + break; |
531 | case DHCPACK: /* ACK received */ |
532 | s->state = DEVST_COMPLETE; |
533 | break; |
534 | @@ -297,28 +338,17 @@ |
535 | |
536 | /* |
537 | * Returns: |
538 | - * 0 = Error, packet not received or discarded |
539 | + * 0 = No dhcp/bootp packet was received |
540 | * 1 = A packet was received and handled |
541 | */ |
542 | static int do_pkt_recv(int pkt_fd, time_t now) |
543 | { |
544 | - int ifindex, ret; |
545 | + int ret; |
546 | struct state *s; |
547 | |
548 | - ret = packet_peek(&ifindex); |
549 | - if (ret == 0) |
550 | - return ret; |
551 | - |
552 | for (s = slist; s; s = s->next) { |
553 | - if (s->dev->ifindex == ifindex) { |
554 | - ret = process_receive_event(s, now); |
555 | - break; |
556 | - } |
557 | + ret |= process_receive_event(s, now); |
558 | } |
559 | - |
560 | - if (ret == 0) |
561 | - packet_discard(); |
562 | - |
563 | return ret; |
564 | } |
565 | |
566 | @@ -328,7 +358,7 @@ |
567 | struct pollfd fds[NR_FDS]; |
568 | struct state *s; |
569 | int pkt_fd; |
570 | - int nr = 0; |
571 | + int nr = 0, rc = 0; |
572 | struct timeval now, prev; |
573 | time_t start; |
574 | |
575 | @@ -393,6 +423,7 @@ |
576 | now.tv_sec - start >= loop_timeout) { |
577 | printf("IP-Config: no response after %d " |
578 | "secs - giving up\n", loop_timeout); |
579 | + rc = -1; |
580 | goto bail; |
581 | } |
582 | |
583 | @@ -407,7 +438,7 @@ |
584 | bail: |
585 | packet_close(); |
586 | |
587 | - return 0; |
588 | + return rc; |
589 | } |
590 | |
591 | static int add_one_dev(struct netdev *dev) |
592 | @@ -480,7 +511,7 @@ |
593 | static int parse_device(struct netdev *dev, const char *ip) |
594 | { |
595 | char *cp; |
596 | - int i, opt; |
597 | + int opt; |
598 | int is_ip = 0; |
599 | |
600 | dprintf("IP-Config: parse_device: \"%s\"\n", ip); |
601 | @@ -502,7 +533,7 @@ |
602 | dev->name = ip; |
603 | } |
604 | } else { |
605 | - for (i = opt = 0; ip && *ip; ip = cp, opt++) { |
606 | + for (opt = 0; ip && *ip; ip = cp, opt++) { |
607 | if ((cp = strchr(ip, ':'))) { |
608 | *cp++ = '\0'; |
609 | } |
610 | @@ -533,7 +564,7 @@ |
611 | case 4: |
612 | strncpy(dev->hostname, ip, SYS_NMLN - 1); |
613 | dev->hostname[SYS_NMLN - 1] = '\0'; |
614 | - memcpy(dev->reqhostname, dev->hostname, |
615 | + memcpy(dev->reqhostname, dev->hostname, |
616 | SYS_NMLN); |
617 | break; |
618 | case 5: |
619 | @@ -721,7 +752,7 @@ |
620 | { |
621 | struct netdev *dev; |
622 | int c, port; |
623 | - int err; |
624 | + int err = 0; |
625 | |
626 | /* If progname is set we're invoked from another program */ |
627 | if (!progname) { |
628 | @@ -799,8 +830,8 @@ |
629 | "dest to %d\n", |
630 | cfg_local_port, cfg_remote_port); |
631 | } |
632 | - loop(); |
633 | + err = loop(); |
634 | } |
635 | |
636 | - return 0; |
637 | + return err; |
638 | } |
639 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/packet.c mkinitrd-magellan/klibc/usr/kinit/ipconfig/packet.c |
640 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/packet.c 2011-11-24 01:38:46.000000000 +0100 |
641 | +++ mkinitrd-magellan/klibc/usr/kinit/ipconfig/packet.c 2011-11-24 01:44:45.000000000 +0100 |
642 | @@ -166,47 +166,14 @@ |
643 | return sendmsg(pkt_fd, &msg, 0); |
644 | } |
645 | |
646 | -/* |
647 | - * Fetches a bootp packet, but doesn't remove it. |
648 | - * Returns: |
649 | - * 0 = Error |
650 | - * >0 = A packet of size "ret" is available for interface ifindex |
651 | - */ |
652 | -int packet_peek(int *ifindex) |
653 | -{ |
654 | - struct sockaddr_ll sll; |
655 | - struct iphdr iph; |
656 | - int ret, sllen = sizeof(struct sockaddr_ll); |
657 | - |
658 | - /* |
659 | - * Peek at the IP header. |
660 | - */ |
661 | - ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), |
662 | - MSG_PEEK, (struct sockaddr *)&sll, &sllen); |
663 | - if (ret == -1) |
664 | - return 0; |
665 | - |
666 | - if (sll.sll_family != AF_PACKET) |
667 | - goto discard_pkt; |
668 | - |
669 | - if (iph.ihl < 5 || iph.version != IPVERSION) |
670 | - goto discard_pkt; |
671 | - |
672 | - *ifindex = sll.sll_ifindex; |
673 | - |
674 | - return ret; |
675 | - |
676 | -discard_pkt: |
677 | - packet_discard(); |
678 | - return 0; |
679 | -} |
680 | - |
681 | -void packet_discard(void) |
682 | +void packet_discard(struct netdev *dev) |
683 | { |
684 | struct iphdr iph; |
685 | struct sockaddr_ll sll; |
686 | socklen_t sllen = sizeof(sll); |
687 | |
688 | + sll.sll_ifindex = dev->ifindex; |
689 | + |
690 | recvfrom(pkt_fd, &iph, sizeof(iph), 0, |
691 | (struct sockaddr *)&sll, &sllen); |
692 | } |
693 | @@ -215,10 +182,11 @@ |
694 | * Receive a bootp packet. The options are listed in iov[1...iov_len]. |
695 | * iov[0] must point to the bootp packet header. |
696 | * Returns: |
697 | - * 0 = Error, try again later |
698 | + * -1 = Error, try again later |
699 | +* 0 = Discarded packet (non-DHCP/BOOTP traffic) |
700 | * >0 = Size of packet |
701 | */ |
702 | -int packet_recv(struct iovec *iov, int iov_len) |
703 | +int packet_recv(struct netdev* dev, struct iovec *iov, int iov_len) |
704 | { |
705 | struct iphdr *ip, iph; |
706 | struct udphdr *udp; |
707 | @@ -232,11 +200,17 @@ |
708 | .msg_flags = 0 |
709 | }; |
710 | int ret, iphl; |
711 | + struct sockaddr_ll sll; |
712 | + socklen_t sllen = sizeof(sll); |
713 | + |
714 | + sll.sll_ifindex = dev->ifindex; |
715 | + msg.msg_name = &sll; |
716 | + msg.msg_namelen = sllen; |
717 | |
718 | ret = recvfrom(pkt_fd, &iph, sizeof(struct iphdr), |
719 | - MSG_PEEK, NULL, NULL); |
720 | + MSG_PEEK, (struct sockaddr *)&sll, &sllen); |
721 | if (ret == -1) |
722 | - return 0; |
723 | + return -1; |
724 | |
725 | if (iph.ihl < 5 || iph.version != IPVERSION) |
726 | goto discard_pkt; |
727 | @@ -292,6 +266,6 @@ |
728 | |
729 | discard_pkt: |
730 | dprintf("discarded\n"); |
731 | - packet_discard(); |
732 | + packet_discard(dev); |
733 | return 0; |
734 | } |
735 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/packet.h mkinitrd-magellan/klibc/usr/kinit/ipconfig/packet.h |
736 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ipconfig/packet.h 2011-11-24 01:38:47.000000000 +0100 |
737 | +++ mkinitrd-magellan/klibc/usr/kinit/ipconfig/packet.h 2011-11-24 01:44:45.000000000 +0100 |
738 | @@ -6,8 +6,7 @@ |
739 | int packet_open(void); |
740 | void packet_close(void); |
741 | int packet_send(struct netdev *dev, struct iovec *iov, int iov_len); |
742 | -int packet_peek(int *ifindex); |
743 | -void packet_discard(void); |
744 | -int packet_recv(struct iovec *iov, int iov_len); |
745 | +void packet_discard(struct netdev *dev); |
746 | +int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len); |
747 | |
748 | #endif /* IPCONFIG_PACKET_H */ |
749 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/name_to_dev.c mkinitrd-magellan/klibc/usr/kinit/name_to_dev.c |
750 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/name_to_dev.c 2011-11-24 01:38:47.000000000 +0100 |
751 | +++ mkinitrd-magellan/klibc/usr/kinit/name_to_dev.c 2011-11-24 01:44:45.000000000 +0100 |
752 | @@ -1,5 +1,4 @@ |
753 | #include <ctype.h> |
754 | -#include <errno.h> |
755 | #include <fcntl.h> |
756 | #include <sys/stat.h> |
757 | #include <stdio.h> |
758 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/dummypmap.c mkinitrd-magellan/klibc/usr/kinit/nfsmount/dummypmap.c |
759 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/dummypmap.c 2011-11-24 01:38:47.000000000 +0100 |
760 | +++ mkinitrd-magellan/klibc/usr/kinit/nfsmount/dummypmap.c 2011-11-24 01:44:45.000000000 +0100 |
761 | @@ -249,6 +249,7 @@ |
762 | if (errno == EINVAL || errno == EADDRINUSE) |
763 | return 0; /* Assume not needed */ |
764 | else { |
765 | + fclose(portmap_filep); |
766 | fprintf(stderr, "%s: portmap spoofing failed\n", |
767 | progname); |
768 | return -1; |
769 | @@ -257,6 +258,7 @@ |
770 | |
771 | spoof_portmap = fork(); |
772 | if (spoof_portmap == -1) { |
773 | + fclose(portmap_filep); |
774 | fprintf(stderr, "%s: cannot fork\n", progname); |
775 | return -1; |
776 | } else if (spoof_portmap == 0) { |
777 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/mount.c mkinitrd-magellan/klibc/usr/kinit/nfsmount/mount.c |
778 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/mount.c 2011-11-24 01:38:47.000000000 +0100 |
779 | +++ mkinitrd-magellan/klibc/usr/kinit/nfsmount/mount.c 2011-11-24 01:44:45.000000000 +0100 |
780 | @@ -44,6 +44,11 @@ |
781 | |
782 | #define MNT_REPLY_MINSIZE (sizeof(struct rpc_reply) + sizeof(uint32_t)) |
783 | |
784 | +#ifndef MNTPROC_MNT |
785 | +# define MNTPROC_MNT 1 |
786 | +# define MNTPROC_UMNT 3 |
787 | +#endif /* MNTPROC_MNT */ |
788 | + |
789 | static int get_ports(uint32_t server, const struct nfs_mount_data *data) |
790 | { |
791 | uint32_t nfs_ver, mount_ver; |
792 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/sunrpc.c mkinitrd-magellan/klibc/usr/kinit/nfsmount/sunrpc.c |
793 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/nfsmount/sunrpc.c 2011-11-24 01:38:47.000000000 +0100 |
794 | +++ mkinitrd-magellan/klibc/usr/kinit/nfsmount/sunrpc.c 2011-11-24 01:44:45.000000000 +0100 |
795 | @@ -1,7 +1,6 @@ |
796 | #include <sys/types.h> |
797 | #include <sys/socket.h> |
798 | #include <netinet/in.h> |
799 | -#include <errno.h> |
800 | #include <poll.h> |
801 | #include <stdio.h> |
802 | #include <string.h> |
803 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ramdisk_load.c mkinitrd-magellan/klibc/usr/kinit/ramdisk_load.c |
804 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/ramdisk_load.c 2011-11-24 01:38:46.000000000 +0100 |
805 | +++ mkinitrd-magellan/klibc/usr/kinit/ramdisk_load.c 2011-11-24 01:44:45.000000000 +0100 |
806 | @@ -1,4 +1,3 @@ |
807 | -#include <ctype.h> |
808 | #include <errno.h> |
809 | #include <fcntl.h> |
810 | #include <stdio.h> |
811 | @@ -243,6 +242,8 @@ |
812 | (fssize == 0 && !(is_gzip = !strcmp(fstype, "gzip")))) { |
813 | fprintf(stderr, |
814 | "Failure loading ramdisk: unknown filesystem type\n"); |
815 | + close(rfd); |
816 | + fclose(wfd); |
817 | return 0; |
818 | } |
819 | |
820 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/resume/resumelib.c mkinitrd-magellan/klibc/usr/kinit/resume/resumelib.c |
821 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/resume/resumelib.c 2011-11-24 01:38:47.000000000 +0100 |
822 | +++ mkinitrd-magellan/klibc/usr/kinit/resume/resumelib.c 2011-11-24 01:44:45.000000000 +0100 |
823 | @@ -2,7 +2,6 @@ |
824 | * Handle resume from suspend-to-disk |
825 | */ |
826 | |
827 | -#include <errno.h> |
828 | #include <fcntl.h> |
829 | #include <stdio.h> |
830 | #include <stdlib.h> |
831 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/kinit/run-init/runinitlib.c mkinitrd-magellan/klibc/usr/kinit/run-init/runinitlib.c |
832 | --- ../tags/mkinitrd-6_3_5/klibc/usr/kinit/run-init/runinitlib.c 2011-11-24 01:38:47.000000000 +0100 |
833 | +++ mkinitrd-magellan/klibc/usr/kinit/run-init/runinitlib.c 2011-11-24 01:44:45.000000000 +0100 |
834 | @@ -40,7 +40,6 @@ |
835 | * On failure, returns a human-readable error message. |
836 | */ |
837 | |
838 | -#include <alloca.h> |
839 | #include <assert.h> |
840 | #include <dirent.h> |
841 | #include <errno.h> |
842 | @@ -157,7 +156,7 @@ |
843 | const char *run_init(const char *realroot, const char *console, |
844 | const char *init, char **initargs) |
845 | { |
846 | - struct stat rst, cst, ist; |
847 | + struct stat rst, cst; |
848 | struct statfs sfs; |
849 | int confd; |
850 | |
851 | @@ -176,10 +175,6 @@ |
852 | if (rst.st_dev == cst.st_dev) |
853 | return "current directory on the same filesystem as the root"; |
854 | |
855 | - /* The initramfs should have /init */ |
856 | - if (stat("/init", &ist) || !S_ISREG(ist.st_mode)) |
857 | - return "can't find /init on initramfs"; |
858 | - |
859 | /* Make sure we're on a ramfs */ |
860 | if (statfs("/", &sfs)) |
861 | return "statfs /"; |
862 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/setjmp.S mkinitrd-magellan/klibc/usr/klibc/arch/arm/setjmp.S |
863 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/setjmp.S 2011-11-24 01:38:51.000000000 +0100 |
864 | +++ mkinitrd-magellan/klibc/usr/klibc/arch/arm/setjmp.S 2011-11-24 01:44:46.000000000 +0100 |
865 | @@ -4,6 +4,8 @@ |
866 | # setjmp/longjmp for the ARM architecture |
867 | # |
868 | |
869 | +#include <klibc/asmmacros.h> |
870 | + |
871 | #ifndef __thumb__ |
872 | |
873 | # |
874 | @@ -29,7 +31,7 @@ |
875 | setjmp: |
876 | stmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} |
877 | mov r0, #0 |
878 | - mov pc, lr |
879 | + BX(lr) |
880 | .size setjmp,.-setjmp |
881 | |
882 | .text |
883 | @@ -39,7 +41,7 @@ |
884 | longjmp: |
885 | ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} |
886 | mov r0, r1 |
887 | - mov pc, lr |
888 | + BX(lr) |
889 | .size longjmp,.-longjmp |
890 | |
891 | #else /* __thumb__ */ |
892 | @@ -75,7 +77,7 @@ |
893 | mov r7, sp |
894 | stmia r0!, {r3, r4, r5, r6, r7} |
895 | mov r0, #0 |
896 | - mov pc, lr |
897 | + BX(lr) |
898 | .size setjmp,.-setjmp |
899 | |
900 | .text |
901 | @@ -96,7 +98,7 @@ |
902 | mov r0, r1 |
903 | bne 1f |
904 | mov r0, #1 |
905 | -1: mov pc, r3 |
906 | +1: BX(r3) |
907 | .size longjmp,.-longjmp |
908 | |
909 | #endif /* __thumb__ */ |
910 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/sysstub.ph mkinitrd-magellan/klibc/usr/klibc/arch/arm/sysstub.ph |
911 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/sysstub.ph 2011-11-24 01:38:51.000000000 +0100 |
912 | +++ mkinitrd-magellan/klibc/usr/klibc/arch/arm/sysstub.ph 2011-11-24 01:44:46.000000000 +0100 |
913 | @@ -52,7 +52,7 @@ |
914 | |
915 | print OUT "#endif /* __thumb__*/\n"; |
916 | |
917 | - print OUT " .size __syscall${i},.-__syscall${i}\n"; |
918 | + print OUT " .size ${fname},.-${fname}\n"; |
919 | } |
920 | |
921 | 1; |
922 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/vfork.S mkinitrd-magellan/klibc/usr/klibc/arch/arm/vfork.S |
923 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/arch/arm/vfork.S 2011-11-24 01:38:51.000000000 +0100 |
924 | +++ mkinitrd-magellan/klibc/usr/klibc/arch/arm/vfork.S 2011-11-24 01:44:46.000000000 +0100 |
925 | @@ -4,6 +4,7 @@ |
926 | * vfork - nasty system call which must not use the stack. |
927 | */ |
928 | |
929 | +#include <klibc/asmmacros.h> |
930 | #include <asm/unistd.h> |
931 | |
932 | .type vfork,#function |
933 | @@ -25,7 +26,7 @@ |
934 | ldrcs r3, 1f |
935 | mvncs r0, #0 |
936 | strcs r2, [r3] |
937 | - mov pc, lr |
938 | + BX(lr) |
939 | |
940 | .balign 4 |
941 | 1: |
942 | @@ -49,7 +50,7 @@ |
943 | str r2, [r1] |
944 | neg r0, r0 |
945 | 1: |
946 | - mov pc, lr |
947 | + BX(lr) |
948 | |
949 | .balign 4 |
950 | 2: |
951 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/CAVEATS mkinitrd-magellan/klibc/usr/klibc/CAVEATS |
952 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/CAVEATS 2011-11-24 01:38:54.000000000 +0100 |
953 | +++ mkinitrd-magellan/klibc/usr/klibc/CAVEATS 2011-11-24 01:44:48.000000000 +0100 |
954 | @@ -1,5 +1,5 @@ |
955 | ------------------------------------------------- |
956 | - Please note the following caveats to using klibc: |
957 | + Please note the following caveats when using klibc: |
958 | ------------------------------------------------- |
959 | |
960 | optimization: |
961 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/execv.c mkinitrd-magellan/klibc/usr/klibc/execv.c |
962 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/execv.c 2011-11-24 01:38:51.000000000 +0100 |
963 | +++ mkinitrd-magellan/klibc/usr/klibc/execv.c 2011-11-24 01:44:46.000000000 +0100 |
964 | @@ -2,7 +2,6 @@ |
965 | * execv.c |
966 | */ |
967 | |
968 | -#include <stdarg.h> |
969 | #include <unistd.h> |
970 | |
971 | int execv(const char *path, char *const *argv) |
972 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/execvp.c mkinitrd-magellan/klibc/usr/klibc/execvp.c |
973 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/execvp.c 2011-11-24 01:38:53.000000000 +0100 |
974 | +++ mkinitrd-magellan/klibc/usr/klibc/execvp.c 2011-11-24 01:44:48.000000000 +0100 |
975 | @@ -2,7 +2,6 @@ |
976 | * execvp.c |
977 | */ |
978 | |
979 | -#include <stdarg.h> |
980 | #include <unistd.h> |
981 | |
982 | int execvp(const char *path, char *const *argv) |
983 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/fgetc.c mkinitrd-magellan/klibc/usr/klibc/fgetc.c |
984 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/fgetc.c 2011-11-24 01:38:51.000000000 +0100 |
985 | +++ mkinitrd-magellan/klibc/usr/klibc/fgetc.c 2011-11-24 01:44:46.000000000 +0100 |
986 | @@ -9,7 +9,6 @@ |
987 | #include <stdio.h> |
988 | #include <unistd.h> |
989 | #include <stdlib.h> |
990 | -#include <errno.h> |
991 | |
992 | int fgetc(FILE *f) |
993 | { |
994 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/getpt.c mkinitrd-magellan/klibc/usr/klibc/getpt.c |
995 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/getpt.c 2011-11-24 01:38:53.000000000 +0100 |
996 | +++ mkinitrd-magellan/klibc/usr/klibc/getpt.c 2011-11-24 01:44:47.000000000 +0100 |
997 | @@ -9,7 +9,6 @@ |
998 | #include <unistd.h> |
999 | #include <termios.h> |
1000 | #include <fcntl.h> |
1001 | -#include <sys/ioctl.h> |
1002 | |
1003 | int getpt(void) |
1004 | { |
1005 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/Kbuild mkinitrd-magellan/klibc/usr/klibc/Kbuild |
1006 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/Kbuild 2011-11-24 01:38:53.000000000 +0100 |
1007 | +++ mkinitrd-magellan/klibc/usr/klibc/Kbuild 2011-11-24 01:44:47.000000000 +0100 |
1008 | @@ -109,7 +109,7 @@ |
1009 | targets += libc.a __static_init.o |
1010 | quiet_cmd_libc = KLIBCAR $@ |
1011 | cmd_libc = rm -f $@; \ |
1012 | - $(KLIBCAR) cq $@ \ |
1013 | + $(call klibc-ar,cq,Dcq) $@ \ |
1014 | $(call objectify,__static_init.o) $(klib-o-files); \ |
1015 | $(KLIBCRANLIB) $@ |
1016 | |
1017 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/posix_openpt.c mkinitrd-magellan/klibc/usr/klibc/posix_openpt.c |
1018 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/posix_openpt.c 2011-11-24 01:38:54.000000000 +0100 |
1019 | +++ mkinitrd-magellan/klibc/usr/klibc/posix_openpt.c 2011-11-24 01:44:48.000000000 +0100 |
1020 | @@ -7,7 +7,6 @@ |
1021 | #include <unistd.h> |
1022 | #include <termios.h> |
1023 | #include <fcntl.h> |
1024 | -#include <sys/ioctl.h> |
1025 | |
1026 | int posix_openpt(int oflag) |
1027 | { |
1028 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/README.klibc mkinitrd-magellan/klibc/usr/klibc/README.klibc |
1029 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/README.klibc 2011-11-24 01:38:54.000000000 +0100 |
1030 | +++ mkinitrd-magellan/klibc/usr/klibc/README.klibc 2011-11-24 01:44:48.000000000 +0100 |
1031 | @@ -1,6 +1,6 @@ |
1032 | This is klibc, what is intended to be a minimalistic libc subset for |
1033 | use with initramfs. It is deliberately written for small size, |
1034 | -minimal entaglement, and portability, not speed. It is definitely a |
1035 | +minimal entanglement, and portability, not speed. It is definitely a |
1036 | work in progress, and a lot of things are still missing. |
1037 | |
1038 | |
1039 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/socketcalls/Kbuild mkinitrd-magellan/klibc/usr/klibc/socketcalls/Kbuild |
1040 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/socketcalls/Kbuild 2011-11-24 01:38:51.000000000 +0100 |
1041 | +++ mkinitrd-magellan/klibc/usr/klibc/socketcalls/Kbuild 2011-11-24 01:44:46.000000000 +0100 |
1042 | @@ -48,3 +48,5 @@ |
1043 | $(obj)/SOCKETCALLS.i \ |
1044 | $(src)/socketcommon.h |
1045 | $(call cmd,socketcalls) |
1046 | + |
1047 | +PHONY += FORCE |
1048 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/syscalls/Kbuild mkinitrd-magellan/klibc/usr/klibc/syscalls/Kbuild |
1049 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/syscalls/Kbuild 2011-11-24 01:38:53.000000000 +0100 |
1050 | +++ mkinitrd-magellan/klibc/usr/klibc/syscalls/Kbuild 2011-11-24 01:44:47.000000000 +0100 |
1051 | @@ -95,3 +95,5 @@ |
1052 | $(src)/syscommon.h $(obj)/syscalls.nrs \ |
1053 | $(obj)/typesize.bin FORCE |
1054 | $(call if_changed,syscalls) |
1055 | + |
1056 | +PHONY += FORCE |
1057 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/system.c mkinitrd-magellan/klibc/usr/klibc/system.c |
1058 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/system.c 2011-11-24 01:38:53.000000000 +0100 |
1059 | +++ mkinitrd-magellan/klibc/usr/klibc/system.c 2011-11-24 01:44:48.000000000 +0100 |
1060 | @@ -7,7 +7,6 @@ |
1061 | * present. |
1062 | */ |
1063 | |
1064 | -#include <errno.h> |
1065 | #include <stdlib.h> |
1066 | #include <unistd.h> |
1067 | #include <signal.h> |
1068 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/fcntl.c mkinitrd-magellan/klibc/usr/klibc/tests/fcntl.c |
1069 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/fcntl.c 2011-11-24 01:38:53.000000000 +0100 |
1070 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/fcntl.c 2011-11-24 01:44:47.000000000 +0100 |
1071 | @@ -5,7 +5,6 @@ |
1072 | #include <stdio.h> |
1073 | #include <unistd.h> |
1074 | #include <fcntl.h> |
1075 | -#include <errno.h> |
1076 | #include <stdlib.h> |
1077 | #include <string.h> |
1078 | |
1079 | @@ -46,5 +45,6 @@ |
1080 | |
1081 | /* Eventually, fork and try to conflict with this lock... */ |
1082 | |
1083 | + close(fd); |
1084 | return 0; |
1085 | } |
1086 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/fnmatch.c mkinitrd-magellan/klibc/usr/klibc/tests/fnmatch.c |
1087 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/fnmatch.c 2011-11-24 01:38:53.000000000 +0100 |
1088 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/fnmatch.c 2011-11-24 01:44:47.000000000 +0100 |
1089 | @@ -11,5 +11,3 @@ |
1090 | |
1091 | return match; |
1092 | } |
1093 | - |
1094 | - |
1095 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/getoptlong.c mkinitrd-magellan/klibc/usr/klibc/tests/getoptlong.c |
1096 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/getoptlong.c 2011-11-24 01:38:52.000000000 +0100 |
1097 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/getoptlong.c 2011-11-24 01:44:47.000000000 +0100 |
1098 | @@ -11,7 +11,7 @@ |
1099 | #include <getopt.h> |
1100 | |
1101 | static int foo = 0; |
1102 | - |
1103 | + |
1104 | static const struct option long_options[] = { |
1105 | { "first", 1, NULL, 'f' }, |
1106 | { "second", 0, NULL, 's' }, |
1107 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/select.c mkinitrd-magellan/klibc/usr/klibc/tests/select.c |
1108 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/select.c 2011-11-24 01:38:52.000000000 +0100 |
1109 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/select.c 2011-11-24 01:44:47.000000000 +0100 |
1110 | @@ -42,7 +42,7 @@ |
1111 | FD_SET(fdz, &readset); |
1112 | |
1113 | rv = select(FD_SETSIZE, &readset, NULL, NULL, &timeout); |
1114 | - |
1115 | + |
1116 | if (rv != 1 || !FD_ISSET(fdz, &readset) || |
1117 | FD_ISSET(fdn, &readset)) { |
1118 | fprintf(stderr, |
1119 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/socket.c mkinitrd-magellan/klibc/usr/klibc/tests/socket.c |
1120 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/socket.c 2011-11-24 01:38:53.000000000 +0100 |
1121 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/socket.c 2011-11-24 01:44:47.000000000 +0100 |
1122 | @@ -16,4 +16,3 @@ |
1123 | |
1124 | return 0; |
1125 | } |
1126 | - |
1127 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/stat.c mkinitrd-magellan/klibc/usr/klibc/tests/stat.c |
1128 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/stat.c 2011-11-24 01:38:52.000000000 +0100 |
1129 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/stat.c 2011-11-24 01:44:47.000000000 +0100 |
1130 | @@ -1,6 +1,5 @@ |
1131 | #include <stdio.h> |
1132 | #include <stdlib.h> |
1133 | -#include <errno.h> |
1134 | #include <sys/stat.h> |
1135 | #include <sys/sysmacros.h> |
1136 | #include <sys/types.h> |
1137 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/statfs.c mkinitrd-magellan/klibc/usr/klibc/tests/statfs.c |
1138 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/statfs.c 2011-11-24 01:38:52.000000000 +0100 |
1139 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/statfs.c 2011-11-24 01:44:47.000000000 +0100 |
1140 | @@ -1,6 +1,5 @@ |
1141 | #include <stdio.h> |
1142 | #include <stdlib.h> |
1143 | -#include <errno.h> |
1144 | #include <sys/vfs.h> |
1145 | |
1146 | static void do_statfs(const char *path) |
1147 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/testvsnp.c mkinitrd-magellan/klibc/usr/klibc/tests/testvsnp.c |
1148 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/tests/testvsnp.c 2011-11-24 01:38:53.000000000 +0100 |
1149 | +++ mkinitrd-magellan/klibc/usr/klibc/tests/testvsnp.c 2011-11-24 01:44:47.000000000 +0100 |
1150 | @@ -1,5 +1,4 @@ |
1151 | #include <assert.h> |
1152 | -#include <stdarg.h> |
1153 | #include <stddef.h> |
1154 | #include <stdint.h> |
1155 | #include <string.h> |
1156 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/klibc/version mkinitrd-magellan/klibc/usr/klibc/version |
1157 | --- ../tags/mkinitrd-6_3_5/klibc/usr/klibc/version 2011-11-24 01:38:53.000000000 +0100 |
1158 | +++ mkinitrd-magellan/klibc/usr/klibc/version 2011-11-24 01:44:48.000000000 +0100 |
1159 | @@ -1 +1 @@ |
1160 | -1.5.19 |
1161 | +1.5.22 |
1162 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/cat.c mkinitrd-magellan/klibc/usr/utils/cat.c |
1163 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/cat.c 2011-11-24 01:38:51.000000000 +0100 |
1164 | +++ mkinitrd-magellan/klibc/usr/utils/cat.c 2011-11-24 01:44:46.000000000 +0100 |
1165 | @@ -39,13 +39,6 @@ |
1166 | #define __RCSID(arg) |
1167 | #endif |
1168 | |
1169 | -#if HAVE_NBTOOL_CONFIG_H |
1170 | -#include "nbtool_config.h" |
1171 | -#endif |
1172 | - |
1173 | -#ifndef __KLIBC__ |
1174 | -#include <sys/cdefs.h> |
1175 | -#endif |
1176 | #if !defined(lint) |
1177 | __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ |
1178 | The Regents of the University of California. All rights reserved.\n"); |
1179 | @@ -60,14 +53,8 @@ |
1180 | #include <sys/stat.h> |
1181 | |
1182 | #include <ctype.h> |
1183 | -#ifndef __KLIBC__ |
1184 | -#include <err.h> |
1185 | -#endif |
1186 | #include <errno.h> |
1187 | #include <fcntl.h> |
1188 | -#ifndef __KLIBC__ |
1189 | -#include <locale.h> |
1190 | -#endif |
1191 | #include <stdio.h> |
1192 | #include <stdlib.h> |
1193 | #include <string.h> |
1194 | @@ -88,11 +75,6 @@ |
1195 | int ch; |
1196 | struct flock stdout_lock; |
1197 | |
1198 | -#ifndef __KLIBC__ |
1199 | - setprogname(argv[0]); |
1200 | - (void)setlocale(LC_ALL, ""); |
1201 | -#endif |
1202 | - |
1203 | while ((ch = getopt(argc, argv, "beflnstuv")) != -1) |
1204 | switch (ch) { |
1205 | case 'b': |
1206 | @@ -117,9 +99,7 @@ |
1207 | tflag = vflag = 1; /* -t implies -v */ |
1208 | break; |
1209 | case 'u': |
1210 | -#ifndef __KLIBC__ |
1211 | - setbuf(stdout, NULL); |
1212 | -#endif |
1213 | + /* unimplemented */ |
1214 | break; |
1215 | case 'v': |
1216 | vflag = 1; |
1217 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/cpio.c mkinitrd-magellan/klibc/usr/utils/cpio.c |
1218 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/cpio.c 2011-11-24 01:38:51.000000000 +0100 |
1219 | +++ mkinitrd-magellan/klibc/usr/utils/cpio.c 2011-11-24 01:44:46.000000000 +0100 |
1220 | @@ -104,7 +104,7 @@ |
1221 | char *c_tar_linkname; |
1222 | }; |
1223 | |
1224 | -/* Total number of bytes read and written for all files. |
1225 | +/* Total number of bytes read and written for all files. |
1226 | * Now that many tape drives hold more than 4Gb we need more than 32 |
1227 | * bits to hold input_bytes and output_bytes. |
1228 | */ |
1229 | @@ -157,7 +157,7 @@ |
1230 | descriptor OUT_DES and reset `output_size' and `out_buff'. |
1231 | If `swapping_halfwords' or `swapping_bytes' is set, |
1232 | do the appropriate swapping first. Our callers have |
1233 | - to make sure to only set these flags if `output_size' |
1234 | + to make sure to only set these flags if `output_size' |
1235 | is appropriate (a multiple of 4 for `swapping_halfwords', |
1236 | 2 for `swapping_bytes'). The fact that DISK_IO_BLOCK_SIZE |
1237 | must always be a multiple of 4 helps us (and our callers) |
1238 | @@ -365,8 +365,7 @@ |
1239 | for (i = 0; i < hash_num; i++) |
1240 | hash_insert(old_table[i]); |
1241 | |
1242 | - if (old_table != NULL) |
1243 | - free(old_table); |
1244 | + free(old_table); |
1245 | } |
1246 | |
1247 | /* Insert the new record and increment the count of elements in the |
1248 | @@ -407,7 +406,7 @@ |
1249 | return NULL; |
1250 | } |
1251 | |
1252 | -/* Try and create a hard link from FILE_NAME to another file |
1253 | +/* Try and create a hard link from FILE_NAME to another file |
1254 | with the given major/minor device number and inode. If no other |
1255 | file with the same major/minor/inode numbers is known, add this file |
1256 | to the list of known files and associated major/minor/inode numbers |
1257 | @@ -482,10 +481,10 @@ |
1258 | return 0; |
1259 | } |
1260 | |
1261 | -/* The newc and crc formats store multiply linked copies of the same file |
1262 | - in the archive only once. The actual data is attached to the last link |
1263 | - in the archive, and the other links all have a filesize of 0. When a |
1264 | - file in the archive has multiple links and a filesize of 0, its data is |
1265 | +/* The newc and crc formats store multiply linked copies of the same file |
1266 | + in the archive only once. The actual data is attached to the last link |
1267 | + in the archive, and the other links all have a filesize of 0. When a |
1268 | + file in the archive has multiple links and a filesize of 0, its data is |
1269 | probably "attatched" to another file in the archive, so we can't create |
1270 | it right away. We have to "defer" creating it until we have created |
1271 | the file that has the data "attatched" to it. We keep a list of the |
1272 | @@ -680,8 +679,8 @@ |
1273 | |
1274 | tape_skip_padding(in_file_des, file_hdr->c_filesize); |
1275 | if (file_hdr->c_nlink > 1) { |
1276 | - /* (see comment above for how the newc and crc formats |
1277 | - store multiple links). Now that we have the data |
1278 | + /* (see comment above for how the newc and crc formats |
1279 | + store multiple links). Now that we have the data |
1280 | for this file, create any other links to it which |
1281 | we defered. */ |
1282 | create_defered_links(file_hdr); |
1283 | @@ -914,8 +913,7 @@ |
1284 | ah += 8; |
1285 | } |
1286 | /* Read file name from input. */ |
1287 | - if (file_hdr->c_name != NULL) |
1288 | - free(file_hdr->c_name); |
1289 | + free(file_hdr->c_name); |
1290 | file_hdr->c_name = (char *)xmalloc(file_hdr->c_namesize); |
1291 | tape_buffered_read(file_hdr->c_name, in_des, |
1292 | (long)file_hdr->c_namesize); |
1293 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/dd.c mkinitrd-magellan/klibc/usr/utils/dd.c |
1294 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/dd.c 2011-11-24 01:38:51.000000000 +0100 |
1295 | +++ mkinitrd-magellan/klibc/usr/utils/dd.c 2011-11-24 01:44:46.000000000 +0100 |
1296 | @@ -486,6 +486,7 @@ |
1297 | wr_fd = open(OPT_OF->str, flags, 0666); |
1298 | if (wr_fd == -1) { |
1299 | perror("open output file"); |
1300 | + close(rd_fd); |
1301 | return 1; |
1302 | } |
1303 | } |
1304 | @@ -493,14 +494,20 @@ |
1305 | /* |
1306 | * Skip obs-sized blocks of output file. |
1307 | */ |
1308 | - if (OPT_SEEK->str && skip_blocks(wr_fd, out_buf, seek, obs)) |
1309 | + if (OPT_SEEK->str && skip_blocks(wr_fd, out_buf, seek, obs)) { |
1310 | + close(rd_fd); |
1311 | + close(wr_fd); |
1312 | return 1; |
1313 | + } |
1314 | |
1315 | /* |
1316 | * Skip ibs-sized blocks of input file. |
1317 | */ |
1318 | - if (OPT_SKIP->str && skip_blocks(rd_fd, in_buf, skip, ibs)) |
1319 | + if (OPT_SKIP->str && skip_blocks(rd_fd, in_buf, skip, ibs)) { |
1320 | + close(rd_fd); |
1321 | + close(wr_fd); |
1322 | return 1; |
1323 | + } |
1324 | |
1325 | memset(&stats, 0, sizeof(stats)); |
1326 | |
1327 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/dmesg.c mkinitrd-magellan/klibc/usr/utils/dmesg.c |
1328 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/dmesg.c 2011-11-24 01:38:51.000000000 +0100 |
1329 | +++ mkinitrd-magellan/klibc/usr/utils/dmesg.c 2011-11-24 01:44:46.000000000 +0100 |
1330 | @@ -1,5 +1,4 @@ |
1331 | #include <unistd.h> |
1332 | -#include <errno.h> |
1333 | #include <stdio.h> |
1334 | #include <ctype.h> |
1335 | #include <stdlib.h> |
1336 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/losetup.c mkinitrd-magellan/klibc/usr/utils/losetup.c |
1337 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/losetup.c 2011-11-24 01:38:51.000000000 +0100 |
1338 | +++ mkinitrd-magellan/klibc/usr/utils/losetup.c 2011-11-24 01:44:46.000000000 +0100 |
1339 | @@ -17,6 +17,7 @@ |
1340 | #include <sys/stat.h> |
1341 | #include <sys/mman.h> |
1342 | #include <sys/sysmacros.h> |
1343 | +#include <stdarg.h> |
1344 | #include <string.h> |
1345 | |
1346 | #include "loop.h" |
1347 | @@ -339,6 +340,7 @@ |
1348 | } |
1349 | if (ioctl (fd, LOOP_CLR_FD, 0) < 0) { |
1350 | perror ("ioctl: LOOP_CLR_FD"); |
1351 | + close (fd); |
1352 | return 1; |
1353 | } |
1354 | close (fd); |
1355 | @@ -348,9 +350,6 @@ |
1356 | } |
1357 | |
1358 | |
1359 | -#include <getopt.h> |
1360 | -#include <stdarg.h> |
1361 | - |
1362 | int verbose = 0; |
1363 | char *progname; |
1364 | |
1365 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/mkfifo.c mkinitrd-magellan/klibc/usr/utils/mkfifo.c |
1366 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/mkfifo.c 2011-11-24 01:38:51.000000000 +0100 |
1367 | +++ mkinitrd-magellan/klibc/usr/utils/mkfifo.c 2011-11-24 01:44:46.000000000 +0100 |
1368 | @@ -1,6 +1,5 @@ |
1369 | #include <sys/stat.h> |
1370 | #include <sys/types.h> |
1371 | -#include <errno.h> |
1372 | #include <fcntl.h> |
1373 | #include <signal.h> |
1374 | #include <stdio.h> |
1375 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/mknod.c mkinitrd-magellan/klibc/usr/utils/mknod.c |
1376 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/mknod.c 2011-11-24 01:38:51.000000000 +0100 |
1377 | +++ mkinitrd-magellan/klibc/usr/utils/mknod.c 2011-11-24 01:44:46.000000000 +0100 |
1378 | @@ -20,6 +20,8 @@ |
1379 | dev_t dev; |
1380 | |
1381 | progname = *argv++; |
1382 | + if (argc == 1) |
1383 | + usage(); |
1384 | |
1385 | if (argv[0][0] == '-' && argv[0][1] == 'm' && !argv[0][2]) { |
1386 | mode_set = strtoul(argv[1], &endp, 8); |
1387 | @@ -36,7 +38,7 @@ |
1388 | typec = type[0]; |
1389 | |
1390 | mode = 0; |
1391 | - switch (type[0]) { |
1392 | + switch (typec) { |
1393 | case 'c': |
1394 | mode = S_IFCHR; |
1395 | break; |
1396 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/nuke.c mkinitrd-magellan/klibc/usr/utils/nuke.c |
1397 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/nuke.c 2011-11-24 01:38:51.000000000 +0100 |
1398 | +++ mkinitrd-magellan/klibc/usr/utils/nuke.c 2011-11-24 01:44:46.000000000 +0100 |
1399 | @@ -32,7 +32,6 @@ |
1400 | * do anything. |
1401 | */ |
1402 | |
1403 | -#include <alloca.h> |
1404 | #include <assert.h> |
1405 | #include <dirent.h> |
1406 | #include <errno.h> |
1407 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/usr/utils/umount.c mkinitrd-magellan/klibc/usr/utils/umount.c |
1408 | --- ../tags/mkinitrd-6_3_5/klibc/usr/utils/umount.c 2011-11-24 01:38:51.000000000 +0100 |
1409 | +++ mkinitrd-magellan/klibc/usr/utils/umount.c 2011-11-24 01:44:46.000000000 +0100 |
1410 | @@ -2,7 +2,6 @@ |
1411 | * by rmk |
1412 | */ |
1413 | #include <sys/mount.h> |
1414 | -#include <errno.h> |
1415 | #include <stdio.h> |
1416 | #include <stdlib.h> |
1417 | #include <string.h> |
1418 | diff -Naur ../tags/mkinitrd-6_3_5/klibc/VERSION mkinitrd-magellan/klibc/VERSION |
1419 | --- ../tags/mkinitrd-6_3_5/klibc/VERSION 2011-11-24 01:38:55.000000000 +0100 |
1420 | +++ mkinitrd-magellan/klibc/VERSION 2011-11-24 01:44:48.000000000 +0100 |
1421 | @@ -1 +1 @@ |
1422 | -1.5.19 |
1423 | +1.5.22 |