cvs commit: src/lib/libc/stdlib getenv.c
src/tools/regression/environ envctl.c envtest.t
scf at FreeBSD.org
Sat Aug 2 02:39:30 UTC 2008
scf 2008-08-02 02:34:35 UTC
FreeBSD src repository
tools/regression/environ envctl.c envtest.t
SVN rev 181150 on 2008-08-02 02:34:35Z by scf
Detect if the application has cleared the environ variable by setting
the first value (environ) to NULL. This is in addition to the
current detection of environ being replaced, which includes being set to
NULL. Without this fix, the environment is not truly wiped, but appears
to be by getenv() until an *env() call is made to alter the enviroment.
This change is necessary to support those applications that use this
method for clearing environ such as Dovecot and Postfix. Applications
such as Sendmail and the base system's env replace environ (already
detected). While neither of these methods are defined by SUSv3, it is
best to support them due to historic reasons and in lieu of a clean,
Add extra units tests for clearing environ using four different methods:
1. Set environ to NULL pointer.
2. Set environ to NULL pointer.
3. Set environ to calloc()'d NULL-terminated array.
4. Set environ to static NULL-terminated array.
Noticed by: Timo Sirainen
MFC after: 3 days
Revision Changes Path
1.14 +12 -7 src/lib/libc/stdlib/getenv.c
1.6 +29 -12 src/tools/regression/environ/envctl.c
1.4 +41 -13 src/tools/regression/environ/envtest.t
More information about the cvs-src