delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/09/06:33:31

Date: Mon, 9 Aug 1999 11:17:18 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Mark E." <snowball3 AT bigfoot DOT com>
cc: djgpp-workers AT delorie DOT com
Subject: Re: suggestion for getenv.c
In-Reply-To: <199908082020.UAA80886@out1.ibm.net>
Message-ID: <Pine.SUN.3.91.990809111651.19120F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 8 Aug 1999, Mark E. wrote:

> *************** getenv(const char *name)
> *** 9,15 ****
>   {
>     int i;
>   
> !   if (environ == 0)
>       return 0;
>   
>     for (i=0; environ[i]; i++)
> --- 10,16 ----
>   {
>     int i;
>   
> !   if (environ == 0 || name == 0)
>       return 0;

Why should we silently ignore a NULL pointer?  If anything, we should
set errno to EFAULT.  `environ' being NULL is a valid situation, but
passing a NULL `name' is not.

- Raw text -


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