Skip to content

Commit

Permalink
use stat() replace readdir
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinwilliams committed Feb 1, 2019
1 parent f912f80 commit 2b06ada
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ int IsDirectoryNewThan( char *path , time_t mtime )
if( Snprintf( sub_path , sizeof(sub_path) , "%s/%s" , path , dirent->d_name ) == NULL )
return -2;

if( dirent->d_type == DT_DIR )
memset( & dir_stat , 0x00 , sizeof(struct stat) );
nret = stat( sub_path , & dir_stat ) ;
if( nret == -1 )
return -3;
if( S_ISDIR(dir_stat.st_mode) )
{
memset( & dir_stat , 0x00 , sizeof(struct stat) );
nret = stat( sub_path , & dir_stat ) ;
if( nret == -1 )
return -3;
if( dir_stat.st_mtime > mtime )
return 1;

Expand Down

0 comments on commit 2b06ada

Please sign in to comment.