From 39a7ded22df3f0bae46706800da6eeede744c14f Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sat, 25 Oct 2014 16:12:16 +0200
Subject: [PATCH] tools/ffhash: read errno before calling functions which might
 change it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 tools/ffhash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/ffhash.c b/tools/ffhash.c
index a9f71c26c52..69425277323 100644
--- a/tools/ffhash.c
+++ b/tools/ffhash.c
@@ -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)
-- 
GitLab