lavf/dashenc: Use avpriv_io_delete to delete files.
authorAndrey Semashev <andrey.semashev@gmail.com>
Fri, 30 Nov 2018 09:03:45 +0000 (12:03 +0300)
committerKarthick J <kjeyapal@akamai.com>
Mon, 3 Dec 2018 05:24:47 +0000 (10:54 +0530)
This fixes incorrect handling of file pseudo-URIs (i.e. when the filename
starts with "file:").

libavformat/dashenc.c

index a924f4a..f455a24 100644 (file)
@@ -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);
+        }
     }
 }