From 3b0999969632e2820b846ca8adcef6b346ff7441 Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Sun, 12 Dec 2004 19:53:30 +0000 Subject: 1.0-pre3 --- loader.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'loader.c') diff --git a/loader.c b/loader.c index c08c8f1..d4bc27f 100644 --- a/loader.c +++ b/loader.c @@ -16,15 +16,16 @@ void cText2SkinLoader::Start(void) { DIR *d = opendir(SkinPath().c_str()); if (d) { - struct dirent *ent; - while ((ent = readdir(d)) != NULL) { + struct dirent ent; + struct dirent *result; + while ((readdir_r(d, &ent, &result)) == 0 && result != NULL) { char *path; struct stat buf; - if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) + if (strcmp(result->d_name, ".") == 0 || strcmp(result->d_name, "..") == 0) continue; - asprintf(&path, "%s/%s", SkinPath().c_str(), ent->d_name); + asprintf(&path, "%s/%s", SkinPath().c_str(), result->d_name); if (stat(path, &buf) == 0 && S_ISDIR(buf.st_mode)) - Load(ent->d_name); + Load(result->d_name); free(path); } closedir(d); -- cgit v1.2.3