Mercurial > mplayer.hg
changeset 35399:4d7adee0a7ba
Check stat() return value before utilizing its information.
author | ib |
---|---|
date | Wed, 28 Nov 2012 11:40:52 +0000 |
parents | 14aeceb6c267 |
children | 074069bb765a |
files | gui/ui/gtk/fileselect.c gui/ui/gtk/skinbrowser.c |
diffstat | 2 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/ui/gtk/fileselect.c Mon Nov 26 23:42:36 2012 +0000 +++ b/gui/ui/gtk/fileselect.c Wed Nov 28 11:40:52 2012 +0000 @@ -198,8 +198,7 @@ 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 @@ { 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 @@ 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 @@ 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;
--- a/gui/ui/gtk/skinbrowser.c Mon Nov 26 23:42:36 2012 +0000 +++ b/gui/ui/gtk/skinbrowser.c Wed Nov 28 11:40:52 2012 +0000 @@ -77,8 +77,7 @@ 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;