X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fclosedir.c;h=30d12903517946e2020cc3d4a2e09f0b24389481;hb=547f1057e84f61003a0db4049df3f90725187f0b;hp=df31e86b4e48d24e91a0523d171f4d42a392a6d7;hpb=dc84183747ce1703eb99685b5dbde1f65a143c06;p=debian%2Fgzip diff --git a/lib/closedir.c b/lib/closedir.c index df31e86..30d1290 100644 --- a/lib/closedir.c +++ b/lib/closedir.c @@ -1,5 +1,5 @@ /* Stop reading the entries of a directory. - Copyright (C) 2006-2012 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)