History log of /netbsd-src/lib/libc/stdlib/_env.c (Results 1 – 15 of 15)
Revision Date Author Comments
# 53e64a77 02-Jan-2024 christos <christos@NetBSD.org>

pass lint.


# 6df7a1dc 18-Jul-2023 riastradh <riastradh@NetBSD.org>

libc: Use RB_TREE_INITIALIZER to nix initfini.c/_env.c coupling.

Doesn't actually help to remove _env.c from programs that don't use
it, though, because various internal things like __diagassert13 s

libc: Use RB_TREE_INITIALIZER to nix initfini.c/_env.c coupling.

Doesn't actually help to remove _env.c from programs that don't use
it, though, because various internal things like __diagassert13 still
call getenv.

show more ...


# 3249d3dc 12-Mar-2022 christos <christos@NetBSD.org>

reallocarr returns errno. preserve it.


# 2204e873 12-Mar-2022 nia <nia@NetBSD.org>

_env: use reallocarr


# c510face 20-Apr-2021 christos <christos@NetBSD.org>

Instead of compiling files with -fcommon, create an include file and declare
the 3 symbols that need to be common using an attribute. Put all the 3 symbol
definitions in libc in one place (initfini.c

Instead of compiling files with -fcommon, create an include file and declare
the 3 symbols that need to be common using an attribute. Put all the 3 symbol
definitions in libc in one place (initfini.c). Reviewed by joerg@

show more ...


# e1278de2 22-Feb-2020 kamil <kamil@NetBSD.org>

Avoid NULL pointer arithmetics on environ

_env.c:260:9, pointer expression with base 0 overflowed to 0
_env.c:260:9, load of null pointer of type 'char *'


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

Fix non _REENTRANT build.


# 1ad2891b 09-Sep-2013 tron <tron@NetBSD.org>

Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original

Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.

Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.

show more ...


# 8caf1030 19-Aug-2013 matt <matt@NetBSD.org>

Put the startup code in .text.startup


# adc9c9a3 06-Oct-2011 christos <christos@NetBSD.org>

Provide symbol definitions for environ and __progname. These are duplicate
definitions to the ones provided by csu, but harmless since the linker resolves
them. There are 3 non weak data symbols prov

Provide symbol definitions for environ and __progname. These are duplicate
definitions to the ones provided by csu, but harmless since the linker resolves
them. There are 3 non weak data symbols provided in crt0.o:

D __progname [initialized data, assigned to ""]
B __ps_strings [BSS since assigned to 0]
C environ [common, uninitialized]

__ps_strings had already a second definition in libc (in BSS), now we added
__progname and __ps_strings (in BSS).

To get rid of the duplicate definition, we can remove them from csu, and
move the assignments to libc.

This is done so that libc has no undefined symbols so that linker maps
that want to do:
...
local:
*;
...
don't end up producing link failures for libc.

show more ...


# 4a3a3138 17-Nov-2010 tron <tron@NetBSD.org>

Include "namespace.h" to get namespace protection.


# d0e6f50d 16-Nov-2010 tron <tron@NetBSD.org>

Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment a

Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment array which
is no longer used because the application overwrote "environ".
2.) We find a non-NULL pointer in the allocated environment array after
the end of the environment. This happens if the applications attempts
to clear the environment with something like "environ[0] = NULL;".

show more ...


# 4f54ea76 16-Nov-2010 enami <enami@NetBSD.org>

Fix typos in comment.


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


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