summaryrefslogtreecommitdiff
path: root/gettext-tools/gnulib-lib/closedir.c
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/gnulib-lib/closedir.c')
-rw-r--r--gettext-tools/gnulib-lib/closedir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gettext-tools/gnulib-lib/closedir.c b/gettext-tools/gnulib-lib/closedir.c
index f80843f..30d1290 100644
--- a/gettext-tools/gnulib-lib/closedir.c
+++ b/gettext-tools/gnulib-lib/closedir.c
@@ -1,5 +1,5 @@
/* Stop reading the entries of a directory.
- Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Copyright (C) 2006-2016 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
@@ -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)