]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hdsenc: check mkdir() return code
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 31 Jan 2014 01:56:39 +0000 (02:56 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 31 Jan 2014 02:08:49 +0000 (03:08 +0100)
This also returns failure if the mkdir failure is not due to an already existing
path.

Fixed CID1135749

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/hdsenc.c

index f22875d0cc1e8b0c1e015806349e4abaaa2a5843..fb0a94892aaa7b6f42d779b5fd1a4112c760fa01 100644 (file)
@@ -329,7 +329,14 @@ static int hds_write_header(AVFormatContext *s)
     int ret = 0, i;
     AVOutputFormat *oformat;
 
-    mkdir(s->filename, 0777);
+    if (mkdir(s->filename, 0777)) {
+        int is_error = errno != EEXIST;
+        av_log(s, is_error ? AV_LOG_ERROR : AV_LOG_VERBOSE, "Failed to create directory %s\n", s->filename);
+        if (is_error) {
+            ret = AVERROR(errno);
+            goto fail;
+        }
+    }
 
     oformat = av_guess_format("flv", NULL, NULL);
     if (!oformat) {