Date: Sat, 2 Aug 2008 02:34:35 +0000 (UTC) From: Sean Farley <scf@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/stdlib getenv.c src/tools/regression/environ envctl.c envtest.t Message-ID: <200808020239.m722dU6q022291@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
scf 2008-08-02 02:34:35 UTC FreeBSD src repository Modified files: lib/libc/stdlib getenv.c tools/regression/environ envctl.c envtest.t Log: 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[0]) 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, defined method. Add extra units tests for clearing environ using four different methods: 1. Set environ to NULL pointer. 2. Set environ[0] 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808020239.m722dU6q022291>