1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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>
This commit is contained in:
DJ Delorie
2019-06-19 17:07:41 -04:00
parent 7444810387
commit 6ba205b2c3
4 changed files with 252 additions and 3 deletions

View File

@ -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);