[MPlayer-cvslog] r35493 - in trunk/gui/ui/gtk: fileselect.c skinbrowser.c

ib subversion at mplayerhq.hu
Wed Nov 28 12:40:52 CET 2012


Author: ib
Date: Wed Nov 28 12:40:52 2012
New Revision: 35493

Log:
Check stat() return value before utilizing its information.

Modified:
   trunk/gui/ui/gtk/fileselect.c
   trunk/gui/ui/gtk/skinbrowser.c

Modified: trunk/gui/ui/gtk/fileselect.c
==============================================================================
--- trunk/gui/ui/gtk/fileselect.c	Tue Nov 27 00:42:36 2012	(r35492)
+++ trunk/gui/ui/gtk/fileselect.c	Wed Nov 28 12:40:52 2012	(r35493)
@@ -198,8 +198,7 @@ static void CheckDir( GtkWidget * list )
  glob( "*",0,NULL,&gg );
  for(  i=0;i<gg.gl_pathc;i++ )
   {
-   stat( gg.gl_pathv[i],&fs );
-   if( !S_ISDIR( fs.st_mode ) ) continue;
+   if( ( stat( gg.gl_pathv[i],&fs ) != 0 ) || !S_ISDIR( fs.st_mode ) ) continue;
    clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask);
   }
 
@@ -226,8 +225,7 @@ static void CheckDir( GtkWidget * list )
    {
      char *ext;
 
-     stat( gg.gl_pathv[i],&fs );
-     if(  S_ISDIR( fs.st_mode ) ) continue;
+     if( ( stat( gg.gl_pathv[i],&fs ) != 0 ) || S_ISDIR( fs.st_mode ) ) continue;
 
      ext = strrchr(gg.gl_pathv[i], '.');
 
@@ -332,8 +330,7 @@ void ShowFileSelect( int type,int modal 
    do
     {
      char * c = strrchr( dir,'/' );
-     stat( dir,&f );
-     if ( S_ISDIR( f.st_mode ) ) break;
+     if ( ( stat( dir,&f ) != 0 ) || S_ISDIR( f.st_mode ) ) break;
      if ( c ) *c=0;
     } while ( strrchr( dir,'/' ) );
 
@@ -490,8 +487,7 @@ static void fs_Ok_released( GtkButton * 
  struct stat     fs;
  gchar         * selected;
 
- stat( fsSelectedFile,&fs );
- if(  S_ISDIR(fs.st_mode ) )
+ if( ( stat( fsSelectedFile,&fs ) == 0 ) && S_ISDIR( fs.st_mode ) )
   {
    chdir( fsSelectedFile );
    fsSelectedFile=fsThatDir;

Modified: trunk/gui/ui/gtk/skinbrowser.c
==============================================================================
--- trunk/gui/ui/gtk/skinbrowser.c	Tue Nov 27 00:42:36 2012	(r35492)
+++ trunk/gui/ui/gtk/skinbrowser.c	Wed Nov 28 12:40:52 2012	(r35493)
@@ -77,8 +77,7 @@ int gtkFillSkinList( gchar * mdir )
  for( i=0;i<(int)gg.gl_pathc;i++ )
   {
    if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue;
-   stat( gg.gl_pathv[i],&fs );
-   if ( S_ISDIR( fs.st_mode ) )
+   if ( ( stat( gg.gl_pathv[i],&fs ) == 0 ) && S_ISDIR( fs.st_mode ) )
     {
      tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++;
      if ( !strcmp( tmp,"default" ) ) continue;


More information about the MPlayer-cvslog mailing list