From d3a10dc8651273ec810f35a2f79ddbe06950ecbc Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Tue, 12 May 2020 08:52:05 +0200 Subject: tools: add missing fopen error handling --- tools/input/input.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/input/input.c b/tools/input/input.c index d8a56c1..3ed6983 100644 --- a/tools/input/input.c +++ b/tools/input/input.c @@ -82,6 +82,10 @@ int input_open(DemuxerContext **const c_out, return DAV1D_ERR(ENOMEM); } FILE *f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "Failed to open input file %s: %s\n", filename, strerror(errno)); + return errno ? DAV1D_ERR(errno) : DAV1D_ERR(EIO); + } res = !!fread(probe_data, 1, probe_sz, f); fclose(f); if (!res) { -- cgit v1.2.3