commit 6cfdd9e66519b513e0935c410fbb30fc880efb61
Author: Nicolas Edel <email address hidden>
Date: Fri Nov 18 12:49:22 2011 +0200
pass errno from exec() to parent in spawn()
Open a pipe, set FD_CLOEXEC.
Child: if exec() fails, grab errno and write it to pipe.
Parent: try to read from the pipe -- if you get something, it means the
child didn't exec and the reason is in the pipe. Wait for the child to exit
and return -1 and set errno to whatever the child got.
Also use _exit() instead of exit() when dying in the child after exec
failure -- running exit hooks there would probably be bad.
commit 6cfdd9e66519b51 3e0935c410fbb30 fc880efb61
Author: Nicolas Edel <email address hidden>
Date: Fri Nov 18 12:49:22 2011 +0200
pass errno from exec() to parent in spawn()
Open a pipe, set FD_CLOEXEC.
Child: if exec() fails, grab errno and write it to pipe.
Parent: try to read from the pipe -- if you get something, it means the
child didn't exec and the reason is in the pipe. Wait for the child to exit
and return -1 and set errno to whatever the child got.
Also use _exit() instead of exit() when dying in the child after exec
failure -- running exit hooks there would probably be bad.
(Somewhat edited from Nicolas' original patch.)
Signed-off-by: Nikodemus Siivola <email address hidden>