Web lists-archives.com

Re: Help with C clearenv and setenv

On 5/30/2018 11:56 PM, Marco Atzeri wrote:
> On 5/30/2018 4:48 PM, Sam Habiel wrote:

> environ = calloc(1, sizeof(*environ))

Indeed, this does not surprise me since environ is supposed
to be a pointer to an array of char *, whose last entry is
NULL.  So the above line is the one needed.  It *might*
also work to do something like:

char *dummy = NULL;
environ = &dummy;

This avoids an allocation call.

-- Eliot Moss

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple