tools/ffhash: read errno before calling functions which might change it
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 25 Oct 2014 14:12:16 +0000 (16:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 25 Oct 2014 14:12:16 +0000 (16:12 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tools/ffhash.c

index a9f71c2..6942527 100644 (file)
@@ -94,9 +94,10 @@ static int check(char *file)
     for (;;) {
         int size = read(fd, buffer, SIZE);
         if (size < 0) {
+            int err = errno;
             close(fd);
             finish();
-            printf("+READ-FAILED: %s", strerror(errno));
+            printf("+READ-FAILED: %s", strerror(err));
             ret = 2;
             goto end;
         } else if(!size)