From 39a7ded22df3f0bae46706800da6eeede744c14f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer 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 --- tools/ffhash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ffhash.c b/tools/ffhash.c index a9f71c26c5..6942527732 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)