From 7785ce1c769369abf85b276148548a5510aabb5f Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 20 Oct 2014 00:48:49 +0200 Subject: lavf: replace rename() with ff_rename() The new function wraps errno so that its value is correctly reported when other functions overwrite it (eg. in case of logging). CC: libav-stable@libav.org Bug-Id: CID 1135748 Signed-off-by: Vittorio Giovara --- libavformat/hdsenc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libavformat/hdsenc.c') diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 53fef339b8..ae9275c5ea 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -204,8 +204,7 @@ static int write_manifest(AVFormatContext *s, int final) avio_printf(out, "\n"); avio_flush(out); avio_close(out); - rename(temp_filename, filename); - return 0; + return ff_rename(temp_filename, filename); } static void update_size(AVIOContext *out, int64_t pos) @@ -286,8 +285,7 @@ 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); - return 0; + return ff_rename(temp_filename, filename); } static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) @@ -481,7 +479,9 @@ 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); + ret = ff_rename(os->temp_filename, target_filename); + if (ret < 0) + return ret; add_fragment(os, target_filename, os->frag_start_ts, end_ts - os->frag_start_ts); if (!final) { -- cgit v1.2.3