From 19344efa78be23a02008be9da0991f54455c9f9e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 22 Aug 2022 08:20:49 +0100 Subject: Fix fallback implementaion of getpeereid, from Pino Toscano. --- compat/getpeereid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compat') diff --git a/compat/getpeereid.c b/compat/getpeereid.c index c194e886..b79f420a 100644 --- a/compat/getpeereid.c +++ b/compat/getpeereid.c @@ -18,6 +18,7 @@ #include #include +#include #ifdef HAVE_UCRED_H #include @@ -49,6 +50,8 @@ getpeereid(int s, uid_t *uid, gid_t *gid) ucred_free(ucred); return (0); #else - return (getuid()); + *uid = geteuid(); + *gid = getegid(); + return (0); #endif } -- cgit From 19344ec890e0c4343e3c20695806d482c631d67c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 19 Sep 2022 07:03:17 +0100 Subject: Add headers and fix type, from Marvin Schmidt. GitHub issue 3332. --- compat/systemd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compat') diff --git a/compat/systemd.c b/compat/systemd.c index 7317e43a..9a3adbb3 100644 --- a/compat/systemd.c +++ b/compat/systemd.c @@ -21,6 +21,8 @@ #include +#include + #include "tmux.h" int @@ -29,7 +31,7 @@ systemd_create_socket(int flags, char **cause) int fds; int fd; struct sockaddr_un sa; - int addrlen = sizeof sa; + socklen_t addrlen = sizeof sa; fds = sd_listen_fds(0); if (fds > 1) { /* too many file descriptors */ -- cgit From 5ce34add77fa3517a01e63b915c5f4e3241af470 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 18 Oct 2022 15:58:06 +0100 Subject: Do not attempt to connect to the socket as a client if systemd is active, from Julien Moutinho in GitHub issue 3345. --- compat/systemd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compat') diff --git a/compat/systemd.c b/compat/systemd.c index 9a3adbb3..cce42ed4 100644 --- a/compat/systemd.c +++ b/compat/systemd.c @@ -25,6 +25,12 @@ #include "tmux.h" +int +systemd_activated(void) +{ + return (sd_listen_fds(0) >= 1); +} + int systemd_create_socket(int flags, char **cause) { -- cgit