"Todd C. Miller" <[email protected]> writes:

> It is already safe to call getenv() and unsetenv() when environ is
> NULL so I think it makes sense for setenv() and putenv() to also
> support this.  However, I'd prefer that we just wrap the loop that
> counts the length of environ in an if (environ != NULL) check rather
> than needlessly check for NULL in each iteration of the loop.  This
> also makes it more obvious that the check is for a NULL environ.

Agreed, I also had this in mind.  But then, should the memset call with
a zero size be avoided?

        if (lastenv != environ)
                memcpy(P, environ, cnt * sizeof(char *));

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to