History log of /netbsd-src/lib/libc/stdlib/getenv.c (Results 1 – 25 of 37)
Revision Date Author Comments
# 6600de34 11-Feb-2022 rillig <rillig@NetBSD.org>

libc/getenv: remove trailing whitespace

No binary change.


# 26ba8048 20-Jan-2015 christos <christos@NetBSD.org>

Fix non _REENTRANT build.


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

1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
*internal* interface. It turns out that ld.elf_so(1) and pthread(3

1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
*internal* interface. It turns out that ld.elf_so(1) and pthread(3)
both use it.

Stripping e.g. "LD_LIBRARY_PATH" from the environment while running
setuid binaries works again now.

show more ...


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

Set errno to ENOENT if we reject the environment variable name in
getenv_r() instead of leaving it unchanged.


# 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 ...


# 5260b632 10-Nov-2010 enami <enami@NetBSD.org>

Clear all entries past the NULL while scrubing environ vector.


# ef075363 10-Nov-2010 enami <enami@NetBSD.org>

Indent using tab rather than four spaces.


# ee29967b 04-Nov-2010 christos <christos@NetBSD.org>

scrub the whole array, not just the first n malloced entries.


# 3954ad83 03-Nov-2010 christos <christos@NetBSD.org>

Handle the case where a program attempted to cleanup the environment by
setting *environ = NULL;


# b447d182 02-Nov-2010 enami <enami@NetBSD.org>

- Simplify the code
- Reword the comment.


# ee9d44a7 01-Nov-2010 enami <enami@NetBSD.org>

Double the array only when really necessary. Otherwise memory will be
exhausted if user modifies the variable envrion itself repeatedly..


# 1dc4fb4e 24-Oct-2010 tron <tron@NetBSD.org>

Double the size of the allocate environment vector when we resize it.
This should speed up extending the environment via setenv(3).


# c3bcf19c 02-Oct-2010 tron <tron@NetBSD.org>

Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.


# 7acc3301 01-Oct-2010 christos <christos@NetBSD.org>

make putenv POSIX compliant.


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

If new length is exactly equals to the current length,
there is nothing to do.


# 0588f13b 25-Sep-2010 christos <christos@NetBSD.org>

be more conservative about allocing.


# 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 ...


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

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


# 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.


# cc85a7cf 25-Sep-2005 christos <christos@NetBSD.org>

add getenv_r and ttyname_r


# 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.


# 3fdac2b8 18-Jan-2003 thorpej <thorpej@NetBSD.org>

Merge the nathanw_sa branch.


# ee5e1d12 19-Dec-2000 christos <christos@NetBSD.org>

fix nested extern declaration.


# d8962612 20-Sep-1999 lukem <lukem@NetBSD.org>

back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.


# b48252f3 16-Sep-1999 lukem <lukem@NetBSD.org>

* use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attemp

* use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif

show more ...


12