Date: Fri, 20 Jul 2007 23:30:13 +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 timings.c Message-ID: <200707202330.l6KNUDT4047597@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
scf 2007-07-20 23:30:13 UTC FreeBSD src repository Modified files: lib/libc/stdlib getenv.c tools/regression/environ envctl.c envtest.t timings.c Log: Added environ-replacement detection. For programs that "clean" (i.e., su) or replace (i.e., zdump) the environment after a call to setenv(), putenv() or unsetenv() has been made, a few changes were made. - getenv() will return the value from the new environ array. - setenv() was split into two functions: __setenv() which is most of the previous setenv() without checks on the name and setenv() which contains the checks before calling __setenv(). - setenv(), putenv() and unsetenv() will unset all previous values and call __setenv() on all entries in the new environ array which in turn adds them to the end of the envVars array. Calling __setenv() instead of setenv() is done to avoid the temporary replacement of the '=' in a string with a NUL byte. Some strings may be read-only data. Added more regression checks for clearing the environment array. Replaced gettimeofday() with getrusage() in timing regression check for better accuracy. Fixed an off-by-one bug in __remove_putenv() in the use of memmove(). This went unnoticed due to the allocation of double the number of environ entries when building envVars. Fixed a few spelling mistakes in the comments. Reviewed by: ache Approved by: wes Approved by: re (kensmith) Revision Changes Path 1.10 +163 -78 src/lib/libc/stdlib/getenv.c 1.2 +18 -8 src/tools/regression/environ/envctl.c 1.2 +21 -0 src/tools/regression/environ/envtest.t 1.2 +31 -26 src/tools/regression/environ/timings.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707202330.l6KNUDT4047597>