This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv2] nftw: fill in stat buf for dangling links [BZ #23501]
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: DJ Delorie <dj at redhat dot com>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, tuliom at ascii dot art dot br, libc-alpha at sourceware dot org
- Date: Tue, 25 Jun 2019 10:10:35 +0200
- Subject: Re: [PATCHv2] nftw: fill in stat buf for dangling links [BZ #23501]
- References: <87r27kfqjl.fsf@mid.deneb.enyo.de> <xno92mv8ba.fsf@greed.delorie.com>
On Jun 24 2019, DJ Delorie <dj@redhat.com> wrote:
> diff --git a/io/ftw.c b/io/ftw.c
> index 33e1a5ecab6..92e0119978b 100644
> --- a/io/ftw.c
> +++ b/io/ftw.c
> @@ -424,7 +424,21 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
> else if (data->flags & FTW_PHYS)
> flag = FTW_NS;
> else if (d_type == DT_LNK)
> - flag = FTW_SLN;
> + {
> + int err;
> +
> + flag = FTW_SLN;
> +
> + /* Old code left ST undefined; 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)
> + FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
> + AT_SYMLINK_NOFOLLOW);
> + else
> + LXSTAT (_STAT_VER, name, &st);
> + }
> else
> {
> if (dir->streamfd != -1)
Just remove the branch that handles DT_LINK. The last branch will do
the right thing.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."