summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorAndrey Semashev <andrey.semashev@gmail.com>2018-11-30 12:03:45 +0300
committerKarthick J <kjeyapal@akamai.com>2018-12-03 10:54:47 +0530
commita68a975584462e1cdd1b810956e43025efb6eb04 (patch)
treec85a486ed6d938717dc327d168f303ab8a5f61a2 /libavformat/dashenc.c
parente444b3b184f36e3c97bb3489822f6b05ccb848a8 (diff)
lavf/dashenc: Use avpriv_io_delete to delete files.
This fixes incorrect handling of file pseudo-URIs (i.e. when the filename starts with "file:").
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a924f4af97..f455a24af6 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1347,8 +1347,13 @@ static void dashenc_delete_file(AVFormatContext *s, char *filename) {
av_dict_free(&http_opts);
ff_format_io_close(s, &out);
- } else if (unlink(filename) < 0) {
- av_log(s, AV_LOG_ERROR, "failed to delete %s: %s\n", filename, strerror(errno));
+ } else {
+ int res = avpriv_io_delete(filename);
+ if (res < 0) {
+ char errbuf[AV_ERROR_MAX_STRING_SIZE];
+ av_strerror(res, errbuf, sizeof(errbuf));
+ av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : AV_LOG_ERROR), "failed to delete %s: %s\n", filename, errbuf);
+ }
}
}