diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/xdg.c | 16 | 
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; | 
