[FFmpeg-devel] [PATCH 3/3] ffmpeg_opt: assert_file_overwrite: Work for all file access

Alexander Strasser eclipse7 at gmx.net
Thu Jan 2 20:23:03 CET 2014


Currently the file overwrite check does not work for paths that
contain a colon.

Use avio_check_if_protocol to always execute the check if the
file protocol is used.

Fix other part of ticket #3249.

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
 ffmpeg_opt.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index d267c6d..3d64fbe 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -697,10 +697,7 @@ static void assert_file_overwrite(const char *filename)
         exit_program(1);
     }
 
-    if (!file_overwrite &&
-        (strchr(filename, ':') == NULL || filename[1] == ':' ||
-         av_strstart(filename, "file:", NULL))) {
-        if (avio_check(filename, 0) == 0) {
+    if (!file_overwrite && !avio_check_if_protocol("file", filename, 0)) {
             if (stdin_interaction && !no_file_overwrite) {
                 fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
                 fflush(stderr);
@@ -716,7 +713,6 @@ static void assert_file_overwrite(const char *filename)
                 av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename);
                 exit_program(1);
             }
-        }
     }
 }
 
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140102/e0c33b1a/attachment.asc>


More information about the ffmpeg-devel mailing list