1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

fts: fix errno handling if dirfd fails

* lib/fts.c (fts_build): Use proper errno if dirfd failed.
Although I don’t know of any platform where dirfd can fail here,
we might as well get it right.
This commit is contained in:
Paul Eggert
2022-09-25 18:33:49 -07:00
committed by Bruno Haible
parent 1239f24134
commit a41b6f260c
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -1,3 +1,10 @@
2022-09-25 Paul Eggert <eggert@cs.ucla.edu>
fts: fix errno handling if dirfd fails
* lib/fts.c (fts_build): Use proper errno if dirfd failed.
Although I dont know of any platform where dirfd can fail here,
we might as well get it right.
2022-09-24 Bruno Haible <bruno@clisp.org>
stdalign: Fix compilation error with MSVC in C++ mode.
+2 -1
View File
@@ -1292,11 +1292,12 @@ fts_build (register FTS *sp, int type)
dir_fd = dirfd (dp);
if (dir_fd < 0)
{
int dirfd_errno = errno;
closedir_and_clear (cur->fts_dirp);
if (type == BREAD)
{
cur->fts_info = FTS_DNR;
cur->fts_errno = errno;
cur->fts_errno = dirfd_errno;
}
return NULL;
}