Commit aecd0647 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '803e8227'

* commit '803e8227':
  libavformat: Check mkdir return error codes

Conflicts:
	libavformat/hdsenc.c
	libavformat/smoothstreamingenc.c

See: c89f8f80
See: a3886ea3Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5e752419 803e8227
...@@ -329,13 +329,10 @@ static int hds_write_header(AVFormatContext *s) ...@@ -329,13 +329,10 @@ static int hds_write_header(AVFormatContext *s)
int ret = 0, i; int ret = 0, i;
AVOutputFormat *oformat; AVOutputFormat *oformat;
if (mkdir(s->filename, 0777)) { if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) {
int is_error = errno != EEXIST; av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->filename);
av_log(s, is_error ? AV_LOG_ERROR : AV_LOG_VERBOSE, "Failed to create directory %s\n", s->filename); ret = AVERROR(errno);
if (is_error) { goto fail;
ret = AVERROR(errno);
goto fail;
}
} }
oformat = av_guess_format("flv", NULL, NULL); oformat = av_guess_format("flv", NULL, NULL);
......
...@@ -292,7 +292,7 @@ static int ism_write_header(AVFormatContext *s) ...@@ -292,7 +292,7 @@ static int ism_write_header(AVFormatContext *s)
int ret = 0, i; int ret = 0, i;
AVOutputFormat *oformat; AVOutputFormat *oformat;
if (mkdir(s->filename, 0777) < 0) { if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) {
av_log(s, AV_LOG_ERROR, "mkdir failed\n"); av_log(s, AV_LOG_ERROR, "mkdir failed\n");
ret = AVERROR(errno); ret = AVERROR(errno);
goto fail; goto fail;
...@@ -322,7 +322,7 @@ static int ism_write_header(AVFormatContext *s) ...@@ -322,7 +322,7 @@ static int ism_write_header(AVFormatContext *s)
goto fail; goto fail;
} }
snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(%d)", s->filename, s->streams[i]->codec->bit_rate); snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(%d)", s->filename, s->streams[i]->codec->bit_rate);
if (mkdir(os->dirname, 0777) < 0) { if (mkdir(os->dirname, 0777) == -1 && errno != EEXIST) {
ret = AVERROR(errno); ret = AVERROR(errno);
av_log(s, AV_LOG_ERROR, "mkdir failed\n"); av_log(s, AV_LOG_ERROR, "mkdir failed\n");
goto fail; goto fail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment