cmdutils: fix success path
authorJean Delvare <jdelvare@suse.de>
Wed, 11 Feb 2015 13:18:27 +0000 (14:18 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Feb 2015 16:28:11 +0000 (17:28 +0100)
Since commit 934f2d2f5c16df8aad9f401a9fd842b5d9a78b11,
cmdutils_read_file() prints a confusing message on success:

IO error: Success

This is because the error message is printed on the success path as
well. Add the missing condition so that it is only printed on error.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
cmdutils.c

index 6c40df9..46d0b4b 100644 (file)
@@ -1912,7 +1912,8 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
     }
 
 out:
-    av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", av_err2str(ret));
+    if (ret < 0)
+        av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", av_err2str(ret));
     fclose(f);
     return ret;
 }