cws2fws: check fstat return code.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 26 Oct 2012 15:57:42 +0000 (17:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 26 Oct 2012 16:24:50 +0000 (18:24 +0200)
Fixes CID733720
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tools/cws2fws.c

index c7b62df..84feda9 100644 (file)
@@ -62,7 +62,10 @@ int main(int argc, char *argv[])
         return 1;
     }
 
-    fstat(fd_in, &statbuf);
+    if (fstat(fd_in, &statbuf) < 0) {
+        perror("fstat failed");
+        return 1;
+    }
     comp_len   = statbuf.st_size;
     uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24);