diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-11 16:27:14 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-11 16:30:07 +0100 |
commit | 95d2fc6a76f3e0a98329f1ca70f98e7c085f0abf (patch) | |
tree | 27eb64dabef63fa8d25c6dfcb7fa2fac28eff28c /libavformat | |
parent | 7441d1ec330da810a0ffd44a02b2fc60add5b719 (diff) | |
download | ffmpeg-95d2fc6a76f3e0a98329f1ca70f98e7c085f0abf.tar.gz |
avformat/hdsenc: Check rename() return value
Fixes CID1135748
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/hdsenc.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 08ae5490d2..c9b7bcdf98 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -204,7 +204,10 @@ static int write_manifest(AVFormatContext *s, int final) avio_printf(out, "</manifest>\n"); avio_flush(out); avio_close(out); - rename(temp_filename, filename); + if (rename(temp_filename, filename) == -1) { + av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename); + return AVERROR(errno); + } return 0; } @@ -286,7 +289,10 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final) update_size(out, afrt_pos); update_size(out, 0); avio_close(out); - rename(temp_filename, filename); + if (rename(temp_filename, filename) == -1) { + av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", temp_filename, filename); + return AVERROR(errno); + } return 0; } @@ -475,7 +481,10 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final, snprintf(target_filename, sizeof(target_filename), "%s/stream%dSeg1-Frag%d", s->filename, index, os->fragment_index); - rename(os->temp_filename, target_filename); + if (rename(os->temp_filename, target_filename) == -1) { + av_log(s, AV_LOG_ERROR, "failed to rename file %s to %s\n", os->temp_filename, target_filename); + return AVERROR(errno); + } add_fragment(os, target_filename, os->frag_start_ts, end_ts - os->frag_start_ts); if (!final) { |