mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-20 01:40:14 -05:00
Merge branch 'restore-sighup-handler'
This commit is contained in:
commit
6671d53859
3 changed files with 9 additions and 2 deletions
|
|
@ -151,6 +151,7 @@
|
||||||
in the right-most column.
|
in the right-most column.
|
||||||
* Multi-column characters being cut in half when resizing the
|
* Multi-column characters being cut in half when resizing the
|
||||||
alternate screen.
|
alternate screen.
|
||||||
|
* Restore `SIGHUP` in spawned processes.
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
6
slave.c
6
slave.c
|
|
@ -274,10 +274,12 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
||||||
_exit(errno_copy);
|
_exit(errno_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore signal mask */
|
/* Restore signal mask, and SIG_IGN'd signals */
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0) {
|
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0 ||
|
||||||
|
sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
||||||
|
{
|
||||||
const int errno_copy = errno;
|
const int errno_copy = errno;
|
||||||
LOG_ERRNO_P(errno, "failed to restore signals");
|
LOG_ERRNO_P(errno, "failed to restore signals");
|
||||||
(void)!write(fork_pipe[1], &errno_copy, sizeof(errno_copy));
|
(void)!write(fork_pipe[1], &errno_copy, sizeof(errno_copy));
|
||||||
|
|
|
||||||
4
spawn.c
4
spawn.c
|
|
@ -44,6 +44,10 @@ spawn(struct reaper *reaper, const char *cwd, char *const argv[],
|
||||||
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
|
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0)
|
||||||
goto child_err;
|
goto child_err;
|
||||||
|
|
||||||
|
/* Restore ignored (SIG_IGN) signals */
|
||||||
|
if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
||||||
|
goto child_err;
|
||||||
|
|
||||||
bool close_stderr = stderr_fd >= 0;
|
bool close_stderr = stderr_fd >= 0;
|
||||||
bool close_stdout = stdout_fd >= 0 && stdout_fd != stderr_fd;
|
bool close_stdout = stdout_fd >= 0 && stdout_fd != stderr_fd;
|
||||||
bool close_stdin = stdin_fd >= 0 && stdin_fd != stdout_fd && stdin_fd != stderr_fd;
|
bool close_stdin = stdin_fd >= 0 && stdin_fd != stdout_fd && stdin_fd != stderr_fd;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue