aboutsummaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rw-r--r--usr/gen_init_cpio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 59df70d9d1dc..f463cafdccb2 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -309,18 +309,18 @@ static int cpio_mkfile(const char *name, const char *location,
309 309
310 mode |= S_IFREG; 310 mode |= S_IFREG;
311 311
312 retval = stat (location, &buf);
313 if (retval) {
314 fprintf (stderr, "File %s could not be located\n", location);
315 goto error;
316 }
317
318 file = open (location, O_RDONLY); 312 file = open (location, O_RDONLY);
319 if (file < 0) { 313 if (file < 0) {
320 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);
321 goto error; 315 goto error;
322 } 316 }
323 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
324 filebuf = malloc(buf.st_size); 324 filebuf = malloc(buf.st_size);
325 if (!filebuf) { 325 if (!filebuf) {
326 fprintf (stderr, "out of memory\n"); 326 fprintf (stderr, "out of memory\n");