summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/local.h
AgeCommit message (Collapse)Author
2010-11-14Improve and simplify implementation of *env(3) functions:tron
- 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.
2010-11-03Handle the case where a program attempted to cleanup the environment bychristos
setting *environ = NULL;
2010-09-25Remember memory used by allocated environment variables instead oftron
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.
2010-09-23Use a bit array to keep track of malloced environment entries so we canchristos
free them.
2009-10-21Remove 3rd and 4th clauses in christos' license. OK christos.snj
1997-07-13Add local.h for local prototypes.christos
Fix namespace issues for strtoq and strtouq Fix gcc warnings. Fix RCSID's