You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
libavformat: Check mkdir return error codes
Previously, the returned error codes were intentionally ignored
(see fadd3a6821
), 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>
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user