projects
/
debian
/
gzip
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New upstream version 1.8
[debian/gzip]
/
lib
/
opendir.c
diff --git
a/lib/opendir.c
b/lib/opendir.c
index de0ea5a24f60dffc793bd5683cac43ece299dbdb..a135fd834a87688c1aac61a1822139f84021a58b 100644
(file)
--- a/
lib/opendir.c
+++ b/
lib/opendir.c
@@
-1,5
+1,5
@@
/* Start reading the entries of a directory.
/* Start reading the entries of a directory.
- Copyright (C) 2006-201
3
Free Software Foundation, Inc.
+ Copyright (C) 2006-201
6
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
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 <unistd.h>
#endif
# include <unistd.h>
#endif
+#ifdef __KLIBC__
+# include <io.h>
+# include <fcntl.h>
+#endif
+
DIR *
opendir (const char *dir_name)
{
DIR *
opendir (const char *dir_name)
{
@@
-51,6
+56,22
@@
opendir (const char *dir_name)
if (dirp == NULL)
return NULL;
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];
#else
char dir_name_mask[MAX_PATH + 1 + 1 + 1];