X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fclosedir.c;h=562a3ec07bee13ee98cc2fd27b2016c20fe2f23b;hb=8f06a4236e1807caa727ed306216c6a0aea026f0;hp=fa8e210633befaefe47122baf385108cae2a8e14;hpb=d738e90e8360e101b94fca8c79147f59565f62d8;p=debian%2Fgzip
diff --git a/lib/closedir.c b/lib/closedir.c
index fa8e210..562a3ec 100644
--- a/lib/closedir.c
+++ b/lib/closedir.c
@@ -1,5 +1,5 @@
/* Stop reading the entries of a directory.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,7 +12,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
+ along with this program. If not, see . */
#include
@@ -39,7 +39,7 @@
int
closedir (DIR *dirp)
{
-# if REPLACE_FCHDIR
+# if REPLACE_FCHDIR || REPLACE_DIRFD
int fd = dirfd (dirp);
# endif
int retval;
@@ -49,6 +49,10 @@ closedir (DIR *dirp)
retval = closedir (dirp);
+# ifdef __KLIBC__
+ if (!retval)
+ _gl_unregister_dirp_fd (fd);
+# endif
#else
if (dirp->current != INVALID_HANDLE_VALUE)