summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-07-28 09:57:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-07-28 09:57:35 (GMT)
commit81a4be1d7f2621a899c23db6243ce5aefddbbe93 (patch)
treeaba9f0db3ae6379fc58c44106a815647fd49e976 /src
parent77f88a59bfb9296df7e995e99218d27862136588 (diff)
Replaced the deprecated readdir_r() function by readdir() calls.
Diffstat (limited to 'src')
-rw-r--r--src/common/xdg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/xdg.c b/src/common/xdg.c
index 5430743..8b7ff5d 100644
--- a/src/common/xdg.c
+++ b/src/common/xdg.c
@@ -25,6 +25,7 @@
#include <dirent.h>
+#include <errno.h>
#include <glib.h>
#include <malloc.h>
#include <stdlib.h>
@@ -60,8 +61,21 @@ char *get_xdg_config_dir(const char *suffix)
directory = opendir(env);
if (directory == NULL) goto default_cfg_dir;
- for (entry = readdir(directory); entry != NULL && result == NULL; entry = readdir(directory))
+ while (1)
{
+ errno = 0;
+
+ entry = readdir(directory);
+
+ if (entry == NULL)
+ {
+ if (errno != 0)
+ perror("readdir");
+
+ break;
+
+ }
+
if (strcmp(entry->d_name, ".") == 0) continue;
if (strcmp(entry->d_name, "..") == 0) continue;