[PATCH v2 5/5] posix: Use posix_spawn for wordexp

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Oct 9 12:18:00 GMT 2019



On 09/10/2019 06:11, Florian Weimer wrote:
> Thanks for the updated patch.
> 
> * Adhemerval Zanella:
> 
>>  static const char *
>>  at_page_end (const char *words)
>>  {
>>    const int pagesize = getpagesize ();
>> -  char *start = mmap (0, 2 * pagesize, PROT_READ|PROT_WRITE,
>> -		      MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
>> +  char *start = xmmap (0, 2 * pagesize, PROT_READ | PROT_WRITE,
>> +		       MAP_PRIVATE | MAP_ANONYMOUS, -1);
>>  
>> -  if (start == MAP_FAILED)
>> -    return start;
>> -
>> -  if (mprotect (start + pagesize, pagesize, PROT_NONE))
>> -    {
>> -      munmap (start, 2 * pagesize);
>> -      return MAP_FAILED;
>> -    }
>> +  xmprotect (start + pagesize, pagesize, PROT_NONE);
> 
> I believe you can use <support/next_to_fault.h> for that.

Ack, I will change to use it.

> 
>> +	if (strncmp (*ep, "IFS=", sizeof ("IFS=")-1) != 0)
> 
> Missing spaces around -.  In my opinion, you should just call strlen.
> GCC will fold it to a constant.

Ack.

> 
>>   /* pid is unset if posix_spawn fails, so it keep the original value
> 
> “pid is not set” or “pid is not updated”, I think.

Ack.

> 
> Rest looks okay to me.
> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list