[FFmpeg-cvslog] avformat/hdsenc: check mkdir() return code

Michael Niedermayer git at videolan.org
Fri Jan 31 03:14:28 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 31 02:56:39 2014 +0100| [c89f8f80cc83622471eaf99e451e78df68475e19] | committer: Michael Niedermayer

avformat/hdsenc: check mkdir() return code

This also returns failure if the mkdir failure is not due to an already existing
path.

Fixed CID1135749

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c89f8f80cc83622471eaf99e451e78df68475e19
---

 libavformat/hdsenc.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index f22875d..fb0a948 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list