]> git.sesse.net Git - vlc/commitdiff
Fix stat() when local charset is not UTF-8
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 15 Aug 2005 14:50:06 +0000 (14:50 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 15 Aug 2005 14:50:06 +0000 (14:50 +0000)
modules/access/file.c

index a6270787e42de337bcd575a7fac5e7b4f5adf519..8b49d1de100ea17044724c2b42ce4abbb9c4921b 100644 (file)
@@ -152,7 +152,6 @@ static int Open( vlc_object_t *p_this )
     char *psz;
 
 #ifdef HAVE_SYS_STAT_H
-    int                 i_stat;
     struct stat         stat_info;
 #endif
     vlc_bool_t          b_stdin;
@@ -163,11 +162,16 @@ static int Open( vlc_object_t *p_this )
     b_stdin = psz_name[0] == '-' && psz_name[1] == '\0';
 
 #ifdef HAVE_SYS_STAT_H
-    if( !b_stdin && (i_stat = stat( psz_name, &stat_info )) == (-1) )
+    if( !b_stdin )
     {
-        msg_Warn( p_access, "cannot stat() file `%s' (%s)",
-                  psz_name, strerror(errno));
-        return VLC_EGENERIC;
+        psz = ToLocale( psz_name );
+        if( stat( psz, &stat_info ) )
+        {
+            msg_Warn( p_access, "%s: %s", psz_name, strerror( errno ) );
+            LocaleFree( psz );
+            return VLC_EGENERIC;
+        }
+        LocaleFree( psz );
     }
 #endif