X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fopendir.c;h=a135fd834a87688c1aac61a1822139f84021a58b;hb=978bac5333774bc6e3191772abdc2b9be98aacca;hp=50e25e305aa980e51f07d769ef5da2d892c77667;hpb=4ee107046a0ffd91f6c60c787326a5e27b799f6d;p=debian%2Fgzip diff --git a/lib/opendir.c b/lib/opendir.c index 50e25e3..a135fd8 100644 --- a/lib/opendir.c +++ b/lib/opendir.c @@ -1,5 +1,5 @@ /* Start 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 @@ -40,6 +40,11 @@ # include #endif +#ifdef __KLIBC__ +# include +# include +#endif + DIR * opendir (const char *dir_name) { @@ -51,6 +56,22 @@ opendir (const char *dir_name) if (dirp == NULL) return NULL; +# ifdef __KLIBC__ + { + int fd = open (dir_name, O_RDONLY); + if (fd == -1 || _gl_register_dirp_fd (fd, dirp)) + { + int saved_errno = errno; + + close (fd); + closedir (dirp); + + errno = saved_errno; + + return NULL; + } + } +# endif #else char dir_name_mask[MAX_PATH + 1 + 1 + 1];