This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: swbz #23501 - define stat buffer for FTW_SLN case


* DJ Delorie:

> http://austingroupbugs.net/view.php?id=1121
> https://sourceware.org/bugzilla/show_bug.cgi?id=23501
>
> Tested with no regressions.
>
> 	* io/ftw.c (process_entry): Define the stat buf in the case of
> 	dangling symlinks, despite FTW_PHYS flag.
>
> diff --git a/io/ftw.c b/io/ftw.c
> index f6ecbe7d90..ac2e38333b 100644
> --- a/io/ftw.c
> +++ b/io/ftw.c
> @@ -424,7 +424,19 @@ 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;
> +	{
> +	  flag = FTW_SLN;
> +
> +	  /* We don't care about any errors that occur here.  Old code
> +	     left ST undefined; a clarification at the ISO level
> +	     defines it for this case, and filling in ST is all we
> +	     need, so this is only "best effort".  */
> +	  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)

“ISO” should be “POSIX”.  This comment is very unclear to me.   Should
we use memset/bzero to get st into a defined state on error?

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]