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

index 8dc285b..c7b62df 100644 (file)
@@ -128,8 +128,8 @@ int main(int argc, char *argv[])
         buf_in[2] = ((zstream.total_out + 8) >> 16) & 0xff;
         buf_in[3] = ((zstream.total_out + 8) >> 24) & 0xff;
 
-        lseek(fd_out, 4, SEEK_SET);
-        if (write(fd_out, &buf_in, 4) < 4) {
+        if (   lseek(fd_out, 4, SEEK_SET) < 0
+            || write(fd_out, &buf_in, 4) < 4) {
             perror("Error writing output file");
             return 1;
         }