=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/client.c,v retrieving revision 1.149 retrieving revision 1.150 diff -c -r1.149 -r1.150 *** src/usr.bin/tmux/client.c 2020/09/22 05:23:34 1.149 --- src/usr.bin/tmux/client.c 2020/10/30 18:54:23 1.150 *************** *** 1,4 **** ! /* $OpenBSD: client.c,v 1.149 2020/09/22 05:23:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: client.c,v 1.150 2020/10/30 18:54:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 36,41 **** --- 36,42 ---- 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,227 **** client_exit(void) { struct client_file *cf; ! size_t left; int waiting = 0; RB_FOREACH (cf, client_files, &client_files) { --- 222,228 ---- client_exit(void) { struct client_file *cf; ! size_t left; int waiting = 0; RB_FOREACH (cf, client_files, &client_files) { *************** *** 763,768 **** --- 764,770 ---- struct sigaction sigact; int status; + log_debug("%s: %s", __func__, strsignal(sig)); if (sig == SIGCHLD) waitpid(WAIT_ANY, &status, WNOHANG); else if (!client_attached) { *************** *** 776,782 **** proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; case SIGTERM: ! client_exitreason = CLIENT_EXIT_TERMINATED; client_exitval = 1; proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; --- 778,785 ---- proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; case SIGTERM: ! if (!client_suspended) ! client_exitreason = CLIENT_EXIT_TERMINATED; client_exitval = 1; proc_send(client_peer, MSG_EXITING, -1, NULL, 0); break; *************** *** 791,796 **** --- 794,800 ---- if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); proc_send(client_peer, MSG_WAKEUP, -1, NULL, 0); + client_suspended = 0; break; } } *************** *** 1003,1008 **** --- 1007,1013 ---- sigact.sa_handler = SIG_DFL; if (sigaction(SIGTSTP, &sigact, NULL) != 0) fatal("sigaction failed"); + client_suspended = 1; kill(getpid(), SIGTSTP); break; case MSG_LOCK: