diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:27:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:27:52 -0500 |
commit | 0c05384a5a1af2352b8c244cf32f480ba6cbf024 (patch) | |
tree | 5090f9d2d07d0bccae3144bb0cdbdf15e8555013 /usr | |
parent | 1542dec1c9109fdcd1c53460f064096f24fc49d2 (diff) | |
parent | bc91c9f313309915f6ec767f56f78dcd0305b20f (diff) |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
mkuboot.sh: Fail if mkimage is missing
gen_init_cpio: checkpatch fixes
gen_init_cpio: Avoid race between call to stat() and call to open()
modpost: Fix address calculation in reloc_location()
Make fixdep error handling more explicit
checksyscalls: Fix stand-alone usage
modpost: Put .zdebug* section on white list
kbuild: fix interaction of CONFIG_IKCONFIG and KCONFIG_CONFIG
kbuild: export linux/{a.out,kvm,kvm_para}.h on headers_install_all
kbuild: introduce HDR_ARCH_LIST for headers_install_all
headers_install: check exit status of unifdef
gen_init_cpio: remove leading `/' from file names
scripts/genksyms: fix header usage
fixdep: use hash table instead of a single array
Diffstat (limited to 'usr')
-rw-r--r-- | usr/gen_init_cpio.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index b2b3c2d1cf8b..7f06884ecd41 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c | |||
@@ -104,6 +104,8 @@ static int cpio_mkslink(const char *name, const char *target, | |||
104 | char s[256]; | 104 | char s[256]; |
105 | time_t mtime = time(NULL); | 105 | time_t mtime = time(NULL); |
106 | 106 | ||
107 | if (name[0] == '/') | ||
108 | name++; | ||
107 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" | 109 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
108 | "%08X%08X%08X%08X%08X%08X%08X", | 110 | "%08X%08X%08X%08X%08X%08X%08X", |
109 | "070701", /* magic */ | 111 | "070701", /* magic */ |
@@ -152,6 +154,8 @@ static int cpio_mkgeneric(const char *name, unsigned int mode, | |||
152 | char s[256]; | 154 | char s[256]; |
153 | time_t mtime = time(NULL); | 155 | time_t mtime = time(NULL); |
154 | 156 | ||
157 | if (name[0] == '/') | ||
158 | name++; | ||
155 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" | 159 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
156 | "%08X%08X%08X%08X%08X%08X%08X", | 160 | "%08X%08X%08X%08X%08X%08X%08X", |
157 | "070701", /* magic */ | 161 | "070701", /* magic */ |
@@ -245,6 +249,8 @@ static int cpio_mknod(const char *name, unsigned int mode, | |||
245 | else | 249 | else |
246 | mode |= S_IFCHR; | 250 | mode |= S_IFCHR; |
247 | 251 | ||
252 | if (name[0] == '/') | ||
253 | name++; | ||
248 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" | 254 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
249 | "%08X%08X%08X%08X%08X%08X%08X", | 255 | "%08X%08X%08X%08X%08X%08X%08X", |
250 | "070701", /* magic */ | 256 | "070701", /* magic */ |
@@ -303,18 +309,18 @@ static int cpio_mkfile(const char *name, const char *location, | |||
303 | 309 | ||
304 | mode |= S_IFREG; | 310 | mode |= S_IFREG; |
305 | 311 | ||
306 | retval = stat (location, &buf); | ||
307 | if (retval) { | ||
308 | fprintf (stderr, "File %s could not be located\n", location); | ||
309 | goto error; | ||
310 | } | ||
311 | |||
312 | file = open (location, O_RDONLY); | 312 | file = open (location, O_RDONLY); |
313 | if (file < 0) { | 313 | if (file < 0) { |
314 | fprintf (stderr, "File %s could not be opened for reading\n", location); | 314 | fprintf (stderr, "File %s could not be opened for reading\n", location); |
315 | goto error; | 315 | goto error; |
316 | } | 316 | } |
317 | 317 | ||
318 | retval = fstat(file, &buf); | ||
319 | if (retval) { | ||
320 | fprintf(stderr, "File %s could not be stat()'ed\n", location); | ||
321 | goto error; | ||
322 | } | ||
323 | |||
318 | filebuf = malloc(buf.st_size); | 324 | filebuf = malloc(buf.st_size); |
319 | if (!filebuf) { | 325 | if (!filebuf) { |
320 | fprintf (stderr, "out of memory\n"); | 326 | fprintf (stderr, "out of memory\n"); |
@@ -332,6 +338,8 @@ static int cpio_mkfile(const char *name, const char *location, | |||
332 | /* data goes on last link */ | 338 | /* data goes on last link */ |
333 | if (i == nlinks) size = buf.st_size; | 339 | if (i == nlinks) size = buf.st_size; |
334 | 340 | ||
341 | if (name[0] == '/') | ||
342 | name++; | ||
335 | namesize = strlen(name) + 1; | 343 | namesize = strlen(name) + 1; |
336 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" | 344 | sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" |
337 | "%08lX%08X%08X%08X%08X%08X%08X", | 345 | "%08lX%08X%08X%08X%08X%08X%08X", |