Improve readdirs to follow symbolic links
[src/app-framework-binder.git] / src / locale-root.c
index c9cdf7d..1d255bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- Copyright 2015 IoT.bzh
+ Copyright (C) 2015-2018 "IoT.bzh"
 
  author: José Bollo <jose.bollo@iot.bzh>
 
@@ -146,7 +146,7 @@ static struct locale_folder *search_folder(struct locale_container *container, c
                        return f;
                if (c >= 0)
                        high = mid;
-               else    
+               else
                        low = mid + 1;
        }
        return NULL;
@@ -193,7 +193,8 @@ static int init_container(struct locale_container *container, int dirfd)
                                return -1;
                        break;
                }
-               if (dent->d_type == DT_DIR || (dent->d_type == DT_UNKNOWN && fstatat(sfd, dent->d_name, &st, 0) == 0 && S_ISDIR(st.st_mode))) {
+               rc = fstatat(sfd, dent->d_name, &st, 0);
+               if (rc == 0 && S_ISDIR(st.st_mode)) {
                        /* directory aka folder */
                        if (dent->d_name[0] == '.' && (dent->d_name[1] == 0 || (dent->d_name[1] == '.' && dent->d_name[2] == 0))) {
                                /* nothing to do for special directories, basic detection, improves if needed */