delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/05/30/23:56:25

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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=xXYaHUJOYd6Bi2wk
rh9i1uiOBA4NLGn4rdT3E+qV4ImJx/ZdbbRQFmUNA9uZ1ejcZN8EhIdSKz8/zMDk
SzfbcVN3FytVGIj31gYInlxp9hgv3cxRjhHS+K6p+7f8nJxkQvwaorTMNnLuNW83
RLvIbn3KgtJJMtCZEI1ddxs8o2k=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=xhZ+PJZtI4/k5fYhzcRWe2
pB5Go=; b=GfISgiZJMvb67RiLRnotwPYvvnregGtnkJSCZ8xwzeN1od1kdfGisi
7ISuUskjslKVozBT85X30y4FGqT7gbg1mEPp1bBOLTUMHML55P2mGDAm+p0X5Z7N
MeHZqDjIYSD7il1Nv+90wtpndWErUH2yM7Hc+IWs+cRSY37Ae8mbI=
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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=
X-HELO: mail-wr0-f177.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xRESe8Rr3UA1cn7XTx0U2JHzk/j/EBwVpxAhGr9hWu0=; b=b7g0r/A3rEJQLJIi58soqV4eJExRuGbEM75Gi2FXe5MCnwyKhjnBcExLTZueHTlyYg Q9+SqiIA+mbwn7E3dWlqe3ay8wohlOg0sKgBDQw4fS9jJeqSNMbXWBLkvv+I9J+fhSQZ EovLFMihL8c6/gJC+uYxK1GJjR/I3MGsrYvF1LkdOe1goUfbzjSDFi+vk0e6iWq78Oi8 SQIPL+kqAjmvck1OYlIGbNecoLuN0KHQUTbS8a4iTt7W4Q2e3a2VjuaMw8u42odP9EH6 GFmjeM7QkvW9/krgzYQeZtayOLtlgOV8Ep4Pg0YPVtc3sROjRyNrr7VQSlSl6amdUedl OzIg==
X-Gm-Message-State: ALKqPweiBaBEjrgNhdM39HtYCZv5qkRDCW/5SKHQYR2hkymksLZ1TYOS Qo4dgxor6zhS9hq1BGdFYXVL3V8P
X-Google-Smtp-Source: ADUXVKKQL+i37edUH8QraLBNI5F8ok3NgoBlNrq6Yvr4KvfNSdSx3h68ozekix0nnoRb/ezzeNWCbQ==
X-Received: by 2002:adf:a873:: with SMTP id l106-v6mr4207442wrc.53.1527738970603; Wed, 30 May 2018 20:56:10 -0700 (PDT)
Subject: Re: Help with C clearenv and setenv
To: cygwin AT cygwin DOT com
References: <CABHT962nB5jK2sNP9jGaVEbWGrvD72hBVN_q6xX9TKuq3yQ0Gg AT mail DOT gmail DOT com>
From: Marco Atzeri <marco DOT atzeri AT gmail DOT com>
Message-ID: <5f1c24df-3312-4497-9b39-7b96a85de982@gmail.com>
Date: Thu, 31 May 2018 05:56:07 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
MIME-Version: 1.0
In-Reply-To: <CABHT962nB5jK2sNP9jGaVEbWGrvD72hBVN_q6xX9TKuq3yQ0Gg@mail.gmail.com>
X-IsSubscribed: yes

On 5/30/2018 4:48 PM, Sam Habiel wrote:
> I have code for a database I am porting to Cygwin.
> 
> Part of that code is a clearenv() then a couple of setenvs. There is
> an ifdef for Cygwin, as it doesn't implement clearenv. It just sets
> environ = NULL. Well--that really breaks setenv! It returns a "Bad
> Poniter" error (-1).
> 
> What is the correct way to clear environment variables in Cygwin?
> 
> --Sam


not tested but it seems Cygwin is not the only platform
with problem on environ = NULL

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

see
https://github.com/samba-team/samba/blob/master/source3/client/smbspool_krb5_wrapper.c

https://github.com/dovecot/core/blob/master/src/lib/env-util.c


--
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