Wiki TODO Entry: check usage of setenv()

Joerg Sonnenberger joerg at
Wed Aug 10 10:57:20 PDT 2005

On Wed, Aug 10, 2005 at 10:41:03AM -0700, Matthew Dillon wrote:
>     I think all we really should care about are suid/sgid programs.  Normal
>     programs... I don't think it matters.  setenv() should basically never
>     fail, anyway.

This might be true for a typical environment, but e.g. once you start
restricting rlimits, it can easily change. It also doesn't mean this the
same probability exists on other system. Keeping the code portable is
useful, not depending on current behaviour is even more important.

I don't think there is a problem to just call err when setenv fails,
maybe thinking twice about ensuring that nothing is left behind. But
doing full error checking should *not* be avoided. If history has
proven anything, than that it will hunt us one day or another.

>     In fact, I'd like to use varsym's to deal with the malloc() flags as well,
>     and get rid of /etc/malloc.conf.

The question is what is faster. The malloc() flags have to be processed
for almost any program, so even a small overhead can add up e.g. for
buildworld or pkgsrc (which does a lot of execs).


More information about the Kernel mailing list