diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-12-05 17:25:04 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-12-05 17:25:04 +0000 |
commit | d53b49e5f58de1d63cb57069c34f8406fc9b86f7 (patch) | |
tree | e0ecfc0523e330ee27515b7ab05bdd75bc9620ba | |
parent | 7129c310626a276f171da52fb0cbddd5c16b5a9b (diff) | |
download | uClibc-alpine-d53b49e5f58de1d63cb57069c34f8406fc9b86f7.tar.bz2 uClibc-alpine-d53b49e5f58de1d63cb57069c34f8406fc9b86f7.tar.xz |
Fix opendir problem when statically linked due to a missing
initialization of the mutex field within DIR struct.
When linked dynamically instead, __pthread_mutex_init will
initialize the mutex itself. Without this fix, any call to
readdir will stuck forever trying to acquire the mutex.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-rw-r--r-- | libc/misc/dirent/opendir.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 338bef17a..cee703e68 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -64,6 +64,7 @@ close_and_ret: if (!(ptr = malloc(sizeof(*ptr)))) goto nomem_close_and_ret; + memset(ptr, '\0', sizeof(DIR)); ptr->dd_fd = fd; ptr->dd_nextloc = ptr->dd_size = ptr->dd_nextoff = 0; |