wl1251: set rate index and preamble flag on received packets
[pandora-kernel.git] / usr / gen_init_cpio.c
index 59df70d..7f06884 100644 (file)
@@ -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");