[vlc-devel] commit: dvdnav: trivially avoid duplicate file path lookup ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Jan 11 15:43:06 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jan 11 16:40:13 2009 +0200| [4f34578d6d159dc5c975d8febe4382428666a4cf] | committer: Rémi Denis-Courmont 

dvdnav: trivially avoid duplicate file path lookup

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

 modules/access/dvdnav.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 953eb23..b1d7863 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1435,16 +1435,15 @@ static int ProbeDVD( demux_t *p_demux, char *psz_name )
         return VLC_SUCCESS;
     }
 
-    if( stat( psz_name, &stat_info ) || !S_ISREG( stat_info.st_mode ) )
+    if( (i_fd = open( psz_name, O_RDONLY )) == -1 )
     {
-        /* Let dvdnav_open() do the probing */
-        return VLC_SUCCESS;
+        return VLC_SUCCESS; /* Let dvdnav_open() do the probing */
     }
 
-    if( (i_fd = open( psz_name, O_RDONLY )) == -1 )
+    if( fstat( i_fd, &stat_info ) || !S_ISREG( stat_info.st_mode ) )
     {
-        /* Let dvdnav_open() do the probing */
-        return VLC_SUCCESS;
+        close( i_fd );
+        return VLC_SUCCESS; /* Let dvdnav_open() do the probing */
     }
 
     /* Try to find the anchor (2 bytes at LBA 256) */




More information about the vlc-devel mailing list