mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
Merge branch 'obsd-master'
This commit is contained in:
5
client.c
5
client.c
@ -36,6 +36,7 @@
|
|||||||
static struct tmuxproc *client_proc;
|
static struct tmuxproc *client_proc;
|
||||||
static struct tmuxpeer *client_peer;
|
static struct tmuxpeer *client_peer;
|
||||||
static uint64_t client_flags;
|
static uint64_t client_flags;
|
||||||
|
static int client_suspended;
|
||||||
static enum {
|
static enum {
|
||||||
CLIENT_EXIT_NONE,
|
CLIENT_EXIT_NONE,
|
||||||
CLIENT_EXIT_DETACHED,
|
CLIENT_EXIT_DETACHED,
|
||||||
@ -765,6 +766,7 @@ client_signal(int sig)
|
|||||||
struct sigaction sigact;
|
struct sigaction sigact;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
log_debug("%s: %s", __func__, strsignal(sig));
|
||||||
if (sig == SIGCHLD)
|
if (sig == SIGCHLD)
|
||||||
waitpid(WAIT_ANY, &status, WNOHANG);
|
waitpid(WAIT_ANY, &status, WNOHANG);
|
||||||
else if (!client_attached) {
|
else if (!client_attached) {
|
||||||
@ -778,6 +780,7 @@ client_signal(int sig)
|
|||||||
proc_send(client_peer, MSG_EXITING, -1, NULL, 0);
|
proc_send(client_peer, MSG_EXITING, -1, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
|
if (!client_suspended)
|
||||||
client_exitreason = CLIENT_EXIT_TERMINATED;
|
client_exitreason = CLIENT_EXIT_TERMINATED;
|
||||||
client_exitval = 1;
|
client_exitval = 1;
|
||||||
proc_send(client_peer, MSG_EXITING, -1, NULL, 0);
|
proc_send(client_peer, MSG_EXITING, -1, NULL, 0);
|
||||||
@ -793,6 +796,7 @@ client_signal(int sig)
|
|||||||
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
proc_send(client_peer, MSG_WAKEUP, -1, NULL, 0);
|
proc_send(client_peer, MSG_WAKEUP, -1, NULL, 0);
|
||||||
|
client_suspended = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1005,6 +1009,7 @@ client_dispatch_attached(struct imsg *imsg)
|
|||||||
sigact.sa_handler = SIG_DFL;
|
sigact.sa_handler = SIG_DFL;
|
||||||
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
if (sigaction(SIGTSTP, &sigact, NULL) != 0)
|
||||||
fatal("sigaction failed");
|
fatal("sigaction failed");
|
||||||
|
client_suspended = 1;
|
||||||
kill(getpid(), SIGTSTP);
|
kill(getpid(), SIGTSTP);
|
||||||
break;
|
break;
|
||||||
case MSG_LOCK:
|
case MSG_LOCK:
|
||||||
|
@ -2023,7 +2023,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
|
|||||||
break;
|
break;
|
||||||
c->flags &= ~CLIENT_SUSPENDED;
|
c->flags &= ~CLIENT_SUSPENDED;
|
||||||
|
|
||||||
if (c->fd == -1) /* exited in the meantime */
|
if (c->fd == -1 || c->session == NULL) /* exited already */
|
||||||
break;
|
break;
|
||||||
s = c->session;
|
s = c->session;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user