This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 5/5] posix: Use posix_spawn for wordexp
- From: Florian Weimer <fweimer at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: Carlos O'Donell <carlos at redhat dot com>, libc-alpha at sourceware dot org
- Date: Wed, 09 Oct 2019 11:11:13 +0200
- Subject: Re: [PATCH v2 5/5] posix: Use posix_spawn for wordexp
- References: <20190731183136.21545-1-adhemerval.zanella@linaro.org> <20190731183136.21545-5-adhemerval.zanella@linaro.org> <87d0f8e4fu.fsf@oldenburg2.str.redhat.com> <3cd9e4da-d5e2-df89-81ea-54835b449661@linaro.org>
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.
> + 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.
> /* pid is unset if posix_spawn fails, so it keep the original value
“pid is not set” or “pid is not updated”, I think.
Rest looks okay to me.
Thanks,
Florian