diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:34:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:34:56 +0000 |
commit | 671f456761fc66649260e831ceee36ec3d4ba9ca (patch) | |
tree | 033c56bded071f681e1304311ba0bff449d477cc /client.c | |
parent | Adding debian version 3.3a-5. (diff) | |
download | tmux-671f456761fc66649260e831ceee36ec3d4ba9ca.tar.xz tmux-671f456761fc66649260e831ceee36ec3d4ba9ca.zip |
Merging upstream version 3.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -245,9 +245,6 @@ client_main(struct event_base *base, int argc, char **argv, uint64_t flags, u_int ncaps = 0; struct args_value *values; - /* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */ - signal(SIGCHLD, SIG_IGN); - /* Set up the initial command. */ if (shell_command != NULL) { msg = MSG_SHELL; @@ -284,6 +281,12 @@ client_main(struct event_base *base, int argc, char **argv, uint64_t flags, log_debug("flags are %#llx", (unsigned long long)client_flags); /* Initialize the client socket and start the server. */ +#ifdef HAVE_SYSTEMD + if (systemd_activated()) { + /* socket-based activation, do not even try to be a client. */ + fd = server_start(client_proc, flags, base, 0, NULL); + } else +#endif fd = client_connect(base, socket_path, client_flags); if (fd == -1) { if (errno == ECONNREFUSED) { @@ -527,11 +530,22 @@ client_signal(int sig) { struct sigaction sigact; int status; + pid_t pid; log_debug("%s: %s", __func__, strsignal(sig)); - if (sig == SIGCHLD) - waitpid(WAIT_ANY, &status, WNOHANG); - else if (!client_attached) { + if (sig == SIGCHLD) { + for (;;) { + pid = waitpid(WAIT_ANY, &status, WNOHANG); + if (pid == 0) + break; + if (pid == -1) { + if (errno == ECHILD) + break; + log_debug("waitpid failed: %s", + strerror(errno)); + } + } + } else if (!client_attached) { if (sig == SIGTERM || sig == SIGHUP) proc_exit(client_proc); } else { @@ -694,6 +708,9 @@ client_dispatch_wait(struct imsg *imsg) !(client_flags & CLIENT_CONTROL), client_file_check_cb, NULL); break; + case MSG_READ_CANCEL: + file_read_cancel(&client_files, imsg); + break; case MSG_WRITE_OPEN: file_write_open(&client_files, client_peer, imsg, 1, !(client_flags & CLIENT_CONTROL), client_file_check_cb, |