From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101460 invoked by alias); 31 May 2018 12:16:00 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 101449 invoked by uid 89); 31 May 2018 12:15:59 -0000 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 Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 May 2018 12:15:57 +0000 Received: from [192.168.0.6] (c-24-62-203-86.hsd1.ma.comcast.net [24.62.203.86]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 35E8D4017AEC; Thu, 31 May 2018 08:15:56 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: Help with C clearenv and setenv To: cygwin@cygwin.com References: <5f1c24df-3312-4497-9b39-7b96a85de982@gmail.com> From: Eliot Moss Message-ID: <178a4992-d334-d2f1-55d9-597324c20b52@cs.umass.edu> Date: Thu, 31 May 2018 13:22:00 -0000 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00333.txt.bz2 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