summaryrefslogtreecommitdiff
path: root/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'loader.c')
-rw-r--r--loader.c11
1 files changed, 6 insertions, 5 deletions
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);