From 18f59a2ae109ff65b83b8be32e800e3a8e68873e Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Tue, 22 Nov 2005 14:58:18 +0000 Subject: [PATCH] Check if file is a regular file git-svn-id: svn://code.dyne.org/veejay/trunk@499 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-current/libel/lav_io.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/veejay-current/libel/lav_io.c b/veejay-current/libel/lav_io.c index f964ef55..7e7a469e 100644 --- a/veejay-current/libel/lav_io.c +++ b/veejay-current/libel/lav_io.c @@ -28,6 +28,7 @@ #include #include #include +#include #include //#include #include @@ -771,7 +772,23 @@ lav_file_t *lav_open_input_file(char *filename, int mmap_size) lav_fd->is_MJPG = 0; lav_fd->MJPG_chroma = CHROMAUNKNOWN; lav_fd->mmap_size = mmap_size; - /* open video file, try AVI first */ + + + /* open file, check if file is a file */ + struct stat s; + if( stat(filename, &s ) != 0 ) + { + if(lav_fd) free(lav_fd); + return NULL; + } + + if(!S_ISREG( s.st_mode) ) + { + veejay_msg(VEEJAY_MSG_ERROR, "'%s' is not a regular file",filename); + if(lav_fd) free(lav_fd); + return NULL; + } + lav_fd->avi_fd = AVI_open_input_file(filename,1,mmap_size); video_format = 'a'; /* for error messages */