This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Error on setenv(..., NULL, ...)


On Wed, Mar 11, 2015 at 11:19 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:

>> Assert would be inconsistent with the other checks: it surely is just as
>> undefined to pass a NULL name.
>>
>
> that's not undefined, the name can be 0 and then EINVAL must be set.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html

Where does it say that NULL name is allowed?

  [EINVAL]
  The envname argument points to an empty string or points to a string
containing an '=' character.

I read that as:

  assert (name != NULL && value != NULL);
  if (*name == '\0' || strchr (name, '=') != NULL)
    ...

-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]