| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:
> Applications shall call either sigemptyset() or sigfillset() at least
> once for each object of type sigset_t prior to any other use of that
> object. If such an object is not initialized in this way, but is
> nonetheless supplied as an argument to any of pthread_sigmask(),
> sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
> sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
> sigwaitinfo(), the results are undefined.
The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Foot installs a SIG_IGN handler for SIGHUP. Ignored signals are
inherited in sub-processes. Thus, we need to restore it to SIG_DFL
before exec:ing.
|
| | |
|
| |
|
|
|
|
|
|
| |
Allow the caller to pass the same FD (for example, a single /dev/null
FD) to spawn().
All we need to do to handle this correctly is ensure we don’t try to
close the same FD multiple times.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
slave: no need to restore signal handlers; they are automatically
restored as long as they are not SIG_IGN (which they never are in
foot).
spawn(): restore signal mask after fork. This fixes an issue where a
terminal spawned with ctrl+shift+n did not terminate when its shell
exited.
Closes #366
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
|
| |
|
|
|
|
|
|
|
| |
When calling ‘reaper_add()’, the caller can provide a callback. If
non-NULL, the reaper will call the callback to handle the actual
reaping.
If the callback is NULL, or if it returns false, the reaper reaps the
child process.
|
| |
|
|
|
| |
This ensures all calls have at least one __VA_ARGS__ argument, thus
making them ISO C99 compliant.
|
| |
|
|
|
| |
If not -1, spawn() will redirect the child's stdin/stdout/stderr to
these FDs.
|
| |
|