* unsetenv() was moving too much memory, thus corrupting the data after

its allocation.
* Added TODO to use a benaphore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25478 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-05-12 20:48:03 +00:00
parent bf681d149a
commit b4e5605e0a

View File

@ -23,6 +23,7 @@
return err;
// TODO: Use benaphore!
static sem_id sEnvLock;
static bool sCopied;
@ -212,9 +213,11 @@ unsetenv(const char *name)
env = find_variable(name, length, &index);
if (env != NULL) {
// we don't free the memory for the slot, we just move the array contents
// we don't free the memory for the slot, we just move the array
// contents
free(env);
memmove(environ + index, environ + index + 1, sizeof(char *) * (count_variables() + 1));
memmove(environ + index, environ + index + 1,
sizeof(char *) * (count_variables() - index));
}
release_sem(sEnvLock);