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

Fix non _REENTRANT build.


# ecaf413a 25-Apr-2013 matt <matt@NetBSD.org>

Remove weak_alias since that's now in the compat_putenv.c


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


# 5d635760 25-Oct-2010 njoly <njoly@NetBSD.org>

Make putenv(3) fails with EINVAL for a null pointer, or for a string
that either miss or start with a `=' character.

Adjust man page and testcase accordingly.


# 4a94dc0b 05-Oct-2010 enami <enami@NetBSD.org>

Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".


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


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

Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).


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

make putenv POSIX compliant.


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


# 60549036 22-Jan-2000 mycroft <mycroft@NetBSD.org>

Delint.
Remove trailing ; from uses of __weak_alias(). The macro inserts this if
needed.


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


# 5f8a6c06 30-Jan-1998 perry <perry@NetBSD.org>

update to lite-2


# 43fa6fe3 21-Jul-1997 jtc <jtc@NetBSD.org>

If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore. The library will

If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore. The library will use those
names internally. Weak aliases are used to provide the original names
to the API.

This is only the first part of this change. It is most of the functions
which are implemented in C for all NetBSD ports. Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.

show more ...


# bd906777 13-Jul-1997 christos <christos@NetBSD.org>

Add local.h for local prototypes.
Fix namespace issues for strtoq and strtouq
Fix gcc warnings.
Fix RCSID's


# 6dda330e 28-Dec-1995 thorpej <thorpej@NetBSD.org>

New-style RCS ids.


# 9bd83209 24-Nov-1993 jtc <jtc@NetBSD.org>

Change C library functions to use strchr() and strrchr() instead of index()
and rindex(). This will allow (strict {ANSI, POSIX, XOPEN}) applications
to redefine index() and rindex() without effectin

Change C library functions to use strchr() and strrchr() instead of index()
and rindex(). This will allow (strict {ANSI, POSIX, XOPEN}) applications
to redefine index() and rindex() without effecting the library internals.

show more ...


# 9c20f740 26-Aug-1993 jtc <jtc@NetBSD.org>

Declare rcsid strings so they are stored in text segment.


# e9d867ef 01-Aug-1993 mycroft <mycroft@NetBSD.org>

Add RCS identifiers.


# 61f28255 21-Mar-1993 cgd <cgd@NetBSD.org>

initial import of 386bsd-0.1 sources