From 55815edca038997ec283569a192a3eca7f2143bc Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 9 Apr 2011 01:32:37 +0200 Subject: prefer avio_check() over url_exist() The problem with url_exist() is that it tries to open a resource in RDONLY mode. If the file is a FIFO and there is already a reading client, the open() call will hang. By using avio_check() with access mode of 0, the second reading process will check if the file exists without attempting to open it, thus avoiding the lock. Fix issue #1663. Signed-off-by: Anton Khirnov --- ffserver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ffserver.c') diff --git a/ffserver.c b/ffserver.c index 5defd40847..d341182a4f 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3679,7 +3679,7 @@ static void build_feed_streams(void) for(feed = first_feed; feed != NULL; feed = feed->next_feed) { int fd; - if (url_exist(feed->feed_filename)) { + if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) { /* See if it matches */ AVFormatContext *s; int matches = 0; @@ -3752,7 +3752,7 @@ static void build_feed_streams(void) unlink(feed->feed_filename); } } - if (!url_exist(feed->feed_filename)) { + if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) { AVFormatContext s1 = {0}, *s = &s1; if (feed->readonly) { -- cgit v1.2.3