diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-10-30 20:01:20 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-10-30 20:01:20 +0000 |
commit | ffe39edf2fdd8f0489c05022ca8f6e9994396881 (patch) | |
tree | c943570051a725f92ef54b4a886cb0db48dc8a82 /client.c | |
parent | d0640609044c06ffa5aeb7a509965ce3f0b1a412 (diff) | |
parent | 95841ba16acafa8c1a516712ad0f2b48e34357e6 (diff) | |
download | rtmux-ffe39edf2fdd8f0489c05022ca8f6e9994396881.tar.gz rtmux-ffe39edf2fdd8f0489c05022ca8f6e9994396881.tar.bz2 rtmux-ffe39edf2fdd8f0489c05022ca8f6e9994396881.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -36,6 +36,7 @@ static struct tmuxproc *client_proc; static struct tmuxpeer *client_peer; static uint64_t client_flags; +static int client_suspended; static enum { CLIENT_EXIT_NONE, CLIENT_EXIT_DETACHED, @@ -221,7 +222,7 @@ static void client_exit(void) { struct client_file *cf; - size_t left; + size_t left; int waiting = 0; RB_FOREACH (cf, client_files, &client_files) { @@ -765,6 +766,7 @@ client_signal(int sig) struct sigaction sigact; int status; + log_debug("%s: %s", __func__, strsignal(sig)); if (sig == SIGCHLD) waitpid(WAIT_ANY, &status, WNOHANG); else if (!client_attached) { @@ -778,7 +780,8 @@ client_signal(int sig) proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; case SIGTERM: - client_exitreason = CLIENT_EXIT_TERMINATED; + if (!client_suspended) + client_exitreason = CLIENT_EXIT_TERMINATED; client_exitval = 1; proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; @@ -793,6 +796,7 @@ client_signal(int sig) if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); proc_send(client_peer, MSG_WAKEUP, -1, NULL, 0); + client_suspended = 0; break; } } @@ -1005,6 +1009,7 @@ client_dispatch_attached(struct imsg *imsg) sigact.sa_handler = SIG_DFL; if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); + client_suspended = 1; kill(getpid(), SIGTSTP); break; case MSG_LOCK: |