diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2018-07-03 15:53:18 +0200 |
---|---|---|
committer | Jose Bollo <jose.bollo@iot.bzh> | 2018-07-03 19:25:38 +0200 |
commit | 4f7f5ae8e1907b23cb74178dea68790a6fa963fe (patch) | |
tree | 372b70876870158114f64396759186ee9dd03168 /src/locale-root.c | |
parent | f645c76e0bfa772aff97141389d45476bf091053 (diff) |
Improve readdirs to follow symbolic links
The use of symbolic links can be helpful in
some cases. That modification takes care of
allowing symbolic links in the exploration
of directories.
Change-Id: I54d9004187ba5942410aca37b890cd4f6925177d
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/locale-root.c')
-rw-r--r-- | src/locale-root.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/locale-root.c b/src/locale-root.c index eef2df4c..1d255bf3 100644 --- a/src/locale-root.c +++ b/src/locale-root.c @@ -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 */ |