summaryrefslogtreecommitdiff
path: root/libavformat/smoothstreamingenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2014-09-05 22:45:11 +0300
committerMartin Storsjö <martin@martin.st>2014-09-07 23:20:29 +0300
commit803e82276b3716bf6012ec69e8854dae14a4fd2b (patch)
treef877587fe407bf32eb417899d927f68f8cf60b78 /libavformat/smoothstreamingenc.c
parent041caf1a63f091745b95a6d51c23fbdcb604d4ce (diff)
libavformat: Check mkdir return error codes
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ö <martin@martin.st>
Diffstat (limited to 'libavformat/smoothstreamingenc.c')
-rw-r--r--libavformat/smoothstreamingenc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 457472dc83..d955b3437e 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -292,7 +292,10 @@ static int ism_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("ismv", NULL, NULL);
if (!oformat) {
@@ -319,7 +322,10 @@ 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);
- mkdir(os->dirname, 0777);
+ if (mkdir(os->dirname, 0777) == -1 && errno != EEXIST) {
+ ret = AVERROR(errno);
+ goto fail;
+ }
ctx = avformat_alloc_context();
if (!ctx) {