aboutsummaryrefslogtreecommitdiff
path: root/io/ftw.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2019-06-19 17:07:41 -0400
committerDJ Delorie <dj@redhat.com>2019-07-08 17:45:13 -0400
commit6ba205b2c35e3e024c8c12d2ee1b73363e84da87 (patch)
tree6dc88a671ae81090700da9af7c24f3811169650d /io/ftw.c
parent744481038703ddc0ce571bdcbedc4f4a722da039 (diff)
downloadglibc-6ba205b2c35e3e024c8c12d2ee1b73363e84da87.zip
glibc-6ba205b2c35e3e024c8c12d2ee1b73363e84da87.tar.gz
glibc-6ba205b2c35e3e024c8c12d2ee1b73363e84da87.tar.bz2
nftw: fill in stat buf for dangling links [BZ #23501]
As per Austin Group interpretation, "the object" wrt a dangling symlink is the symlink itself, despite FTW_PHYS. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/io/ftw.c b/io/ftw.c
index 33e1a5e..fefcf91 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -423,10 +423,12 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
result = -1;
else if (data->flags & FTW_PHYS)
flag = FTW_NS;
- else if (d_type == DT_LNK)
- flag = FTW_SLN;
else
{
+ /* Old code left ST undefined for dangling DT_LNK without
+ FTW_PHYS set; a clarification at the POSIX level suggests
+ it should contain information about the link (ala lstat).
+ We do our best to fill in what data we can. */
if (dir->streamfd != -1)
statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
AT_SYMLINK_NOFOLLOW);