#
fbe76588 |
| 12-Aug-2021 |
andvar <andvar@NetBSD.org> |
fix typos in "environment" word.
|
#
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 ...
|
#
3954ad83 |
| 03-Nov-2010 |
christos <christos@NetBSD.org> |
Handle the case where a program attempted to cleanup the environment by setting *environ = NULL;
|
#
4c968434 |
| 16-Oct-2010 |
njoly <njoly@NetBSD.org> |
Make setenv(3) follow the standard, by rejecting invalid strings. It now fails with EINVAL errno when variable is NULL, empty or contains an `=' character; or value is NULL.
Adjust the man page acco
Make setenv(3) follow the standard, by rejecting invalid strings. It now fails with EINVAL errno when variable is NULL, empty or contains an `=' character; or value is NULL.
Adjust the man page accordingly, and exercize them in the existing environment testcase.
show more ...
|
#
ae557324 |
| 02-Oct-2010 |
tron <tron@NetBSD.org> |
Restore binary compatibility with applications which use putenv(3) on constant strings (e.g. postdrop(1)): - Don't write to the environment string passed to putenv(3). - Don't overwrite the value of
Restore binary compatibility with applications which use putenv(3) on constant strings (e.g. postdrop(1)): - Don't write to the environment string passed to putenv(3). - Don't overwrite the value of an existing environment string unless the memory was actually allocated by setenv(3).
show more ...
|
#
7acc3301 |
| 01-Oct-2010 |
christos <christos@NetBSD.org> |
make putenv POSIX compliant.
|
#
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 ...
|
#
ed5e497e |
| 25-Sep-2010 |
tron <tron@NetBSD.org> |
Remember the correct pointer which we will free later.
|
#
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 ...
|
#
f6033a77 |
| 24-Sep-2010 |
christos <christos@NetBSD.org> |
Fix memory leaks; thanks 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.
|
#
e957123b |
| 23-Sep-2010 |
christos <christos@NetBSD.org> |
PR/43899: Nicolas Joly: setenv(3)/unsetenv(3) memory leak. Partial fix: Don't allocate a new string if the length is equal to the old length, because presumably the old string was also nul terminated
PR/43899: Nicolas Joly: setenv(3)/unsetenv(3) memory leak. Partial fix: Don't allocate a new string if the length is equal to the old length, because presumably the old string was also nul terminated so it has the extra byte needed. The real fix is to keep an adjunct array of bits, one for each environment variable and keep track if the entry was allocated or not so that we can free it in unsetenv.
show more ...
|
#
8f4cd2be |
| 02-Dec-2009 |
enami <enami@NetBSD.org> |
Retain old variables when failed to allocate memory.
|
#
035a506d |
| 01-Nov-2008 |
christos <christos@NetBSD.org> |
use the right variable in memcpy.
|
#
e34e0144 |
| 31-Oct-2008 |
christos <christos@NetBSD.org> |
make __findenv return the offset for the new entry to be inserted when the string is not found, to avoid an additional scan of the environ array in setenv.
|
#
1a940a96 |
| 17-Feb-2005 |
christos <christos@NetBSD.org> |
remove extraneous `*' that caused a core-dump.
|
#
3f899b0a |
| 17-Feb-2005 |
christos <christos@NetBSD.org> |
do some manual CSE.
|
#
f82977b5 |
| 17-Feb-2005 |
tron <tron@NetBSD.org> |
Fix lint warning caused by last change.
|
#
aa6d8c77 |
| 17-Feb-2005 |
enami <enami@NetBSD.org> |
Jump to just before the copy instead of after it. Saves 8 byte on i386.
|
#
d02f179f |
| 17-Feb-2005 |
enami <enami@NetBSD.org> |
Simplify, KNF and plug leaks. Compile test only.
|
#
81a2ba56 |
| 17-Feb-2005 |
christos <christos@NetBSD.org> |
Simplify and KNF. Instead of keeping track if the pointer was allocated, keep a copy of the pointer itself and only re-use it if the current environment is equal to the saved pointer. Idea from OpenB
Simplify and KNF. Instead of keeping track if the pointer was allocated, keep a copy of the pointer itself and only re-use it if the current environment is equal to the saved pointer. Idea from OpenBSD. Avoids problem of re-allocing a non-allocated pointer if a program resets the environment after it has been grown.
show more ...
|
#
eb7c1594 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
|
#
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 ...
|
#
3fdac2b8 |
| 18-Jan-2003 |
thorpej <thorpej@NetBSD.org> |
Merge the nathanw_sa branch.
|