diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-06-11 13:13:21 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-06-11 13:13:21 +0000 |
commit | 500500ec9b7b0d0cef90b48c9b4ddc8866b5f19c (patch) | |
tree | 1d7b3e6fab5c199fdbbaab53ee9532de6a4c8cf7 /gettext-tools/gnulib-lib/opendir.c | |
parent | 6eb5949dd99d174393465069c2fd0bab32deddcc (diff) | |
download | gettext-tarball-master.tar.gz |
gettext-0.19.8.1HEADgettext-0.19.8.1master
Diffstat (limited to 'gettext-tools/gnulib-lib/opendir.c')
-rw-r--r-- | gettext-tools/gnulib-lib/opendir.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gettext-tools/gnulib-lib/opendir.c b/gettext-tools/gnulib-lib/opendir.c index 9f53110..a135fd8 100644 --- a/gettext-tools/gnulib-lib/opendir.c +++ b/gettext-tools/gnulib-lib/opendir.c @@ -1,5 +1,5 @@ /* Start 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 @@ -40,6 +40,11 @@ # include <unistd.h> #endif +#ifdef __KLIBC__ +# include <io.h> +# include <fcntl.h> +#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]; |