History log of /netbsd-src/lib/libc/stdlib/unsetenv.c (Results 1 – 11 of 11)
Revision Date Author Comments
# 26ba8048 20-Jan-2015 christos <christos@NetBSD.org>

Fix non _REENTRANT build.


# fbf4aa16 14-Nov-2010 tron <tron@NetBSD.org>

Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
suggested by Enami Tsugutomo in private e-mail.
This simplifies the code

Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
suggested by Enami Tsugutomo in private e-mail.
This simplifies the code a lot as we no longer need to keep the size
of "environ" in sync with an array of allocated environment variables.
It also makes it possible to free environment variables in unsetenv(3)
if something has changed the order of the "environ" array.
- Fix a bug in getenv(3) and getenv_r(3) which would return bogus
results e.g. for " getenv("A=B") " if an environment variable "A"
with value "B=C" exists.
- Clean up the internal functions:
- Don't expose the read/write lock for the environment to other parts
of "libc". Provide locking functions instead.
- Use "bool" to report success or failure.
- Use "ssize_t" or "size_t" instead of "int" for indexes.
- Provide internal functions with simpler interfaces e.g. don't
combine return values and reference arguments.
- Don't copy "environ" into an allocated block unless we really need
to grow it.

Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by
Joerg Sonnenberger and me. These changes also fix problems in
zsh 4.3.* and pam_ssh according to Joerg.

show more ...


# 2445ce72 30-Sep-2010 tron <tron@NetBSD.org>

Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crash

Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.

show more ...


# 248290ef 29-Sep-2010 enami <enami@NetBSD.org>

Don't put space before close paren.


# 1f5de17d 25-Sep-2010 tron <tron@NetBSD.org>

Unlock the environment lock if __alocenv() fails.


# 5cdca2e6 25-Sep-2010 tron <tron@NetBSD.org>

Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"env

Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"environ" directory and afterwards overwritten with setenv(3) again.

This stops "zsh" from crashing under NetBSD-current.

Code reviewed by Christos Zoulas.

show more ...


# da3a4052 24-Sep-2010 christos <christos@NetBSD.org>

protect the __allocenv call with the mutex; from Enami


# 7db74b9a 23-Sep-2010 christos <christos@NetBSD.org>

Use a bit array to keep track of malloced environment entries so we can
free them.


# 5b84b398 13-Sep-2005 christos <christos@NetBSD.org>

compat core reorg.


# 99410184 26-Jul-2003 salo <salo@NetBSD.org>

netbsd.org->NetBSD.org


# 13dee93f 07-Apr-2003 kleink <kleink@NetBSD.org>

1003.1-2001 has introduced unsetenv() which differs from the current
implementation in not permitting a "name=value" argument.
* Add a conforming __unsetenv13() and do function renaming for
unseten

1003.1-2001 has introduced unsetenv() which differs from the current
implementation in not permitting a "name=value" argument.
* Add a conforming __unsetenv13() and do function renaming for
unsetenv(); preserve old symbol with old behavior.
* Make visible setenv() and unsetenv() for 1003.1-2001 feature selection
macros; resolves PR standards/20479.

show more ...