Only check the stat results when the stat succeeded.

SVN revision: 10772
This commit is contained in:
rbdpngn 2004-07-10 23:14:02 +00:00 committed by rbdpngn
parent 771ef088c0
commit 19236c6dc3
1 changed files with 4 additions and 2 deletions

View File

@ -137,6 +137,7 @@ ecore_path_group_remove(int group_id, char *path)
char *
ecore_path_group_find(int group_id, char *name)
{
int r;
char *p;
struct stat st;
char path[PATH_MAX];
@ -153,8 +154,9 @@ ecore_path_group_find(int group_id, char *name)
p = ecore_list_next(group->paths);
do {
snprintf(path, PATH_MAX, "%s/%s", p, name);
stat(path, &st);
} while (!S_ISREG(st.st_mode) && (p = ecore_list_next(group->paths)));
r = stat(path, &st);
} while (((r < 0) || !S_ISREG(st.st_mode)) &&
(p = ecore_list_next(group->paths)));
if (p)
p = strdup(path);