From 417197ca7ced6f14701137a989dfe0e88edeb6e9 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 10 Jun 2002 21:44:45 +0000 Subject: Kill the libc-lock headers, which we do not use and which are not correct for uClibc. Fix setenv locking to behave itself. -Erik --- libc/stdlib/setenv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libc/stdlib/setenv.c') diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 7f6a1501c..02959ab95 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -26,16 +26,17 @@ #include #ifdef __UCLIBC_HAS_THREADS__ -/* This lock protects against simultaneous modifications of `environ'. */ -# include -__libc_lock_define_initialized (static, envlock) -# define LOCK __libc_lock_lock (envlock) -# define UNLOCK __libc_lock_unlock (envlock) +/* protects against simultaneous modifications of `environ'. */ +#include +static pthread_mutex_t envlock = PTHREAD_MUTEX_INITIALIZER; +# define LOCK pthread_mutex_lock(&envlock) +# define UNLOCK pthread_mutex_unlock(&envlock); #else # define LOCK # define UNLOCK #endif + /* If this variable is not a null pointer we allocated the current environment. */ static char **last_environ; @@ -55,7 +56,7 @@ int __add_to_environ (const char *name, const char *value, const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; - LOCK; + pthread_mutex_lock(&envlock); /* We have to get the pointer now that we have the lock and not earlier since another thread might have created a new environment. */ -- cgit v1.2.3