Merge commit '803e82276b3716bf6012ec69e8854dae14a4fd2b'

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

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

See: c89f8f80cc
See: a3886ea3c5
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-09-08 00:38:26 +02:00
commit aecd064744
2 changed files with 6 additions and 9 deletions

View File

@ -329,13 +329,10 @@ static int hds_write_header(AVFormatContext *s)
int ret = 0, i;
AVOutputFormat *oformat;
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;
}
if (mkdir(s->filename, 0777) == -1 && errno != EEXIST) {
av_log(s, AV_LOG_ERROR , "Failed to create directory %s\n", s->filename);
ret = AVERROR(errno);
goto fail;
}
oformat = av_guess_format("flv", NULL, NULL);

View File

@ -292,7 +292,7 @@ static int ism_write_header(AVFormatContext *s)
int ret = 0, i;
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");
ret = AVERROR(errno);
goto fail;
@ -322,7 +322,7 @@ static int ism_write_header(AVFormatContext *s)
goto fail;
}
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);
av_log(s, AV_LOG_ERROR, "mkdir failed\n");
goto fail;