2 ms·
You can write() to fildes 2, but I'd not recommend it. Instead what I'd recommend is that you have a pipe() for passing an error message (one byte will do) bac
by cryptonector 9y ago
You can write() to fildes 2, but I'd not recommend it.
Instead what I'd recommend is that you have a pipe() for passing an error message (one byte will do) back to the parent, and then _exit().
- FooBarWidget 9y agoEven 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?