2 ms·
Even this is harder than it should be. What if the exec succeeds? The pipe is never closed. If you mark the pipe as O_CLOEXEC and rely on the parent treating
by FooBarWidget 9y ago
Even this is harder than it should be.
What if the exec succeeds? The pipe is never closed.
If you mark the pipe as O_CLOEXEC and rely on the parent treating EOF as success: what if the child crashes prematurely before exec? E.g. killed by sysadmin, or by OOM killer.
What if a write() to the pipe fails?