[FFmpeg-devel] [PATCH 13/13] ffserver_config: check fclose return value

Ganesh Ajjanagadde gajjanagadde at gmail.com
Tue Jan 12 05:25:15 CET 2016


Maybe theoretical; since all files here are opened in read only mode.
Nevertheless, it is a good idea to check the return value.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 ffserver_config.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ffserver_config.c b/ffserver_config.c
index 411db53..b68f97c 100644
--- a/ffserver_config.c
+++ b/ffserver_config.c
@@ -403,7 +403,10 @@ static int ffserver_opt_preset(const char *arg, int type, FFServerConfig *config
             break;
     }
 
-    fclose(f);
+    if (fclose(f))
+        av_log(NULL, AV_LOG_WARNING,
+               "Unable to close preset file '%s': %s\n",
+               filename, av_err2str(AVERROR(errno)));
 
     return ret;
 }
@@ -1281,7 +1284,10 @@ int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config)
         ERROR("Missing closing </%s> tag\n",
               stream ? "Stream" : (feed ? "Feed" : "Redirect"));
 
-    fclose(f);
+    if (fclose(f))
+        av_log(NULL, AV_LOG_WARNING,
+               "Unable to close config file '%s': %s\n",
+               filename, av_err2str(AVERROR(errno)));
     if (ret < 0)
         return ret;
     if (config->errors)
-- 
2.7.0



More information about the ffmpeg-devel mailing list