On 06/22/2016 01:00 PM, Pádraig Brady wrote: > How about the attached instead?
That's a sensible solution. > diff --git a/lib/fts.c b/lib/fts.c > index bcdcff9..d022633 100644 > --- a/lib/fts.c > +++ b/lib/fts.c > @@ -1461,9 +1461,15 @@ fts_build (register FTS *sp, int type) > while (cur->fts_dirp) { > bool is_dir; > size_t d_namelen; > + __set_errno (0); > struct dirent *dp = readdir(cur->fts_dirp); > - if (dp == NULL) > + if (dp == NULL) { > + if (errno) { > + cur->fts_errno = errno; > + cur->fts_info = items ? FTS_ERR : FTS_DNR; s/items/nitems/ > + } > break; > + } > if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) > continue; > > @@ -1622,7 +1628,7 @@ mem1: saved_errno = errno; > > /* If didn't find anything, return NULL. */ > if (!nitems) { > - if (type == BREAD) > + if (type == BREAD && cur->fts_info != FTS_DNR) > cur->fts_info = FTS_DP; > fts_lfree(head); > return (NULL); Other than the above typo, this looks good to me, thanks! Unfortunately, it seems we don't have test for fts.c, do we? Have a nice day, Berny