delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/05/31/08:16:10

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=AeHAb86zJo9WEkLw
vxY7iTv3JWPIQYZsS+7uUNAnKc+pPGfgbSaZ2JcjavqLxOUr+fHRdX3zZhQg6aEk
ZK5Op4WUPXYYpLh7E/vuL65sshmf5dUjkNtM8ezZGApc3gJNc2FU8gkgW8GYlkC1
g4Py/n+mXMMC+UA0Dbr1i+9z220=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=wN3W8lIoWylLMxFaYFQhqy
uoNnw=; b=MXxdoUsCqh01OasOBAWqDT9sTABYslitg1u6QkeEQ22D+of7kL3nUy
vbo0HLiZjQUQGxS8vbxyskla2eA2DNM9QM130CCOQ5wpCtEEkdAncdz4XSgrXFBk
1QQ/hMtdNogQx6EPTkntYk7OlM5Wfmkf6ZmJfCziMHszfSLi0Bj/0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=marco, Marco, atzeri, Atzeri
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: Help with C clearenv and setenv
To: cygwin AT cygwin DOT com
References: <CABHT962nB5jK2sNP9jGaVEbWGrvD72hBVN_q6xX9TKuq3yQ0Gg AT mail DOT gmail DOT com> <5f1c24df-3312-4497-9b39-7b96a85de982 AT gmail DOT com>
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <178a4992-d334-d2f1-55d9-597324c20b52@cs.umass.edu>
Date: Thu, 31 May 2018 08:15:55 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
MIME-Version: 1.0
In-Reply-To: <5f1c24df-3312-4497-9b39-7b96a85de982@gmail.com>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019