summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2007-12-05 17:25:08 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2007-12-05 17:25:08 +0000
commitd91f719bdb06ed1de0931aaf6c2e825ad32b30d1 (patch)
tree67cc15f443ccdb452b643dbc0076eaac2e6f534e /libc
parentb829d83b3a4314e59e20139930594ac59947eb2b (diff)
downloaduClibc-alpine-d91f719bdb06ed1de0931aaf6c2e825ad32b30d1.tar.bz2
uClibc-alpine-d91f719bdb06ed1de0931aaf6c2e825ad32b30d1.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>
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/dirent/opendir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 9380088ff..d0e19a790 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -75,6 +75,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;