summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-12-09 08:07:09 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2015-12-17 20:35:19 +0100
commit2e116b2eeea5f47ca26458b1962783baced2784c (patch)
tree5562a2fc7fbc59d7aabddf5d339e2711bc533efc /libc
parentd1b81113b43a6d26dec4e0e58a380895d121006e (diff)
fix readdir_r returns success code while it in fact failed
Taken from Freetz.org. Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/dirent/readdir_r.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/misc/dirent/readdir_r.c b/libc/misc/dirent/readdir_r.c
index 7cdc0aba1..5beebfed0 100644
--- a/libc/misc/dirent/readdir_r.c
+++ b/libc/misc/dirent/readdir_r.c
@@ -27,7 +27,6 @@ int __READDIR_R(DIR *dir, __DIRENT_TYPE *entry, __DIRENT_TYPE **result)
__set_errno(EBADF);
return(EBADF);
}
- de = NULL;
__UCLIBC_MUTEX_LOCK(dir->dd_lock);
@@ -36,6 +35,7 @@ int __READDIR_R(DIR *dir, __DIRENT_TYPE *entry, __DIRENT_TYPE **result)
/* read dir->dd_max bytes of directory entries. */
bytes = __GETDENTS(dir->dd_fd, dir->dd_buf, dir->dd_max);
if (bytes <= 0) {
+ de = NULL;
*result = NULL;
ret = (bytes==0)? 0 : errno;
goto all_done;