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] [BZ #18433] Check file access/existence before forking.


On Fri, Sep 11, 2015 at 1:48 PM, Florian Weimer <fweimer@redhat.com> wrote:
> The correct way is to set up a pipe with O_CLOEXEC file descriptors in
> the parent prior to forking.  The parent reads from the pipe after
> forking, waiting.  When the execve succeeds, the read in the parent
> completes without returning any data.  On execve failure, the child
> writes the errno value over the pipe, where the parent can read it and
> report it.

I was reading musl source code to figure it out how they handle this
situation , they use exact same method . They use pipe's to get
situation of child .The main key point here is the closure of pipe in
successful execve(O_CLOEXEC).
Implementation of it is not hard at all. I will work on patch to send in days.


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