head sl.cc pe.c ==> sl.cc <== #include <cstdio> #include <cstdlib> class C { public: C(){ printf("C\n"); unsetenv("XXX"); } }; static C c;
==> pe.c <== #include <stdio.h> #include <stdlib.h> int main() { char *p=getenv("XXX"); if (p != NULL) printf("XXX=%s\n",p); return 0; } % g++ -fpic -shared sl.cc -o sl.so % gcc pe.c -o pe 7.x & 8.x ... % sh -c 'XXX=1 LD_PRELOAD=$(pwd)/sl.so pe' C XXX=1 6.x & 4.x ... % sh -c 'XXX=1 LD_PRELOAD=$(pwd)/sl.so pe' C In 6.x and earlier (fedora 16, too), the unsetenv clears the XXX env var apparently in time to affect the exec'd process. In 8.x & 9.x, it seems the environment is set and passed to the exec'd process and the LD_PRELOADed code does not affect that despite its best efforts. It seems to me that 6.x behavior is more correct, but I'm seeking opinions before contemplating if / how to put together a fix. _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"