public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] io: Fix silent readdir failures in ftw/nftw (BZ 33085)
Date: Fri, 17 Apr 2026 18:43:00 -0400	[thread overview]
Message-ID: <xnqzod439n.fsf@greed.delorie.com> (raw)
In-Reply-To: <20260402171224.17813-1-adhemerval.zanella@linaro.org> (message from Adhemerval Zanella on Thu,  2 Apr 2026 14:12:09 -0300)


Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> diff --git a/io/ftw.c b/io/ftw.c
> @@ -246,8 +246,16 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
>  	  struct dirent64 *d;
>  	  size_t actsize = 0;
>  
> -	  while ((d = __readdir64 (st)) != NULL)
> +	  while (1)
>  	    {
> +	      errno = 0;
> +	      d = __readdir64 (st);
> +	      if (d == NULL)
> +		{
> +		  if (errno != 0)
> +		    return -1;

Need to free(buf) here.

> -	    frame->state = FTW_STATE_CLEANUP;
> +	    {
> +	      frame->state = FTW_STATE_CLEANUP;
> +	      if (errno != 0)
> +		result = -1;

And here.

> diff --git a/io/tst-ftw-bz33085.c b/io/tst-ftw-bz33085.c

> +/* The test stress the readdir calls from nftw, where failures should not

typo : stress -> stresses

> +   handled as end of stream.  The first it at 'ftw_dir'

s/it/is/

> +   (FTW_STATE_STREAM_LOOP) for the default entries read.  The another one is
> +   at open_dir_stream where it is triggered when there is a file description
> +   exaustion and the code< must close an existing stream to make room for the

extra < ("code<")

Rest looks OK.


  reply	other threads:[~2026-04-17 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 17:12 Adhemerval Zanella
2026-04-17 22:43 ` DJ Delorie [this message]
2026-04-20 16:40   ` Adhemerval Zanella Netto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xnqzod439n.fsf@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).