From b2d810c17747e62ca847037c2a7c4b76c3874894 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 26 Aug 2012 22:55:06 +0200 Subject: use is_dir function when checking direntry. --- atari/settings.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/atari/settings.c b/atari/settings.c index 0192a97ad..0c87597d3 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -411,17 +411,20 @@ static char * toolbar_iconset_popup( int x, int y ) while (ep = readdir (dp)) { if (strlen(ep->d_name) < 3) continue; - snprintf(fullpath, PATH_MAX-1, "%s/%s", toolbar_folder, ep->d_name ); - if (stat(fullpath, &statbuf) == 0) { - if (S_ISDIR(statbuf.st_mode)) { - if (strcmp(ep->d_name, current) == 0) - selected = navail; + snprintf(fullpath, PATH_MAX-1, "%s/%s", toolbar_folder, ep->d_name ); + if (is_dir(fullpath)) { + if (strcmp(ep->d_name, current) == 0) + selected = navail; /* store the folder name: */ avail[navail] = malloc( strlen(ep->d_name)+1 ); sprintf( avail[navail], "%s", ep->d_name ); navail++; if( navail >= MAX_SETS ) - break; + break; + } + if (stat(fullpath, &statbuf) == 0) { + if (S_ISDIR(statbuf.st_mode)) { + } } } -- cgit v1.2.3