summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2010-12-29 14:07:27 +0000
committerMichal Marek <mmarek@suse.cz>2010-12-29 14:07:27 +0000
commit97accde005fe7a786113fa0c90906c0d26981e87 (patch)
treed15c81d1f19f5cb638dfbfdf88e6c38ffcaca029 /usr
parent5139643a7407d0407c3fe14d8bacef5b0ce7329e (diff)
parent96aebafa63418f447ddc823e40da341cc40553dd (diff)
Merge branch 'kbuild' into for-next
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,
mode |= S_IFREG;
- retval = stat (location, &buf);
- if (retval) {
- fprintf (stderr, "File %s could not be located\n", location);
- goto error;
- }
-
file = open (location, O_RDONLY);
if (file < 0) {
fprintf (stderr, "File %s could not be opened for reading\n", location);
goto error;
}
+ retval = fstat (file, &buf);
+ if (retval) {
+ fprintf (stderr, "File %s could not be stat()'ed\n", location);
+ goto error;
+ }
+
filebuf = malloc(buf.st_size);
if (!filebuf) {
fprintf (stderr, "out of memory\n");