[vlc-devel] commit: Use stat properly (you don't want to open directories or devices... ) ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Sep 18 21:22:17 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Sep 18 21:47:11 2008 +0300| [7a6a50019db4db22d810f01145279b23b6b34e97] | committer: Rémi Denis-Courmont 

Use stat properly (you don't want to open directories or devices...)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a6a50019db4db22d810f01145279b23b6b34e97
---

 src/input/input.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 3623a73..1bcf200 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2643,9 +2643,8 @@ static char *InputGetExtraFiles( input_thread_t *p_input,
 
         snprintf( psz_ext, 5, ".%.3d", i );
 
-        if( utf8_stat( psz_file, &st ) != 0 )
-            break;
-        if( st.st_size <= 0 )
+        if( utf8_stat( psz_file, &st )
+         || !S_ISREG( st.st_mode ) || !st.st_size )
             continue;
 
         msg_Dbg( p_input, "Detected extra file `%s'", psz_file );
@@ -2993,7 +2992,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
 
             strcpy( psz_extension, ".idx" );
 
-            if( !utf8_stat( psz_path, &st ) )
+            if( !utf8_stat( psz_path, &st ) && S_ISREG( st.st_mode ) )
             {
                 msg_Dbg( p_input, "using %s subtitles file instead of %s",
                          psz_path, psz_subtitle );




More information about the vlc-devel mailing list