From 803e82276b3716bf6012ec69e8854dae14a4fd2b Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Fri, 5 Sep 2014 22:45:11 +0300 Subject: libavformat: Check mkdir return error codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the returned error codes were intentionally ignored (see fadd3a68213), to avoid aborting if the directory already existed. If the mkdir actually failed, this was caught when opening files within the directory fails anyway. By handling the error code here (but explicitly ignoring EEXIST), the error messages and return codes in these cases are more appropriate and less confusing. Signed-off-by: Martin Storsjö --- libavformat/hdsenc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavformat/hdsenc.c') diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 6217c1f51f..882f157d91 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -323,7 +323,10 @@ static int hds_write_header(AVFormatContext *s) int ret = 0, i; AVOutputFormat *oformat; - mkdir(s->filename, 0777); + if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) { + ret = AVERROR(errno); + goto fail; + } oformat = av_guess_format("flv", NULL, NULL); if (!oformat) { -- cgit v1.2.3