---
slock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/slock.c b/slock.c
index b5a9b04..856c3e6 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -6,6 +6,7 @@
#include <ctype.h>
#include <errno.h>
+#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <stdarg.h>
_AT_@ -59,7 +60,6 @@ die(const char *errstr, ...)
}
#ifdef __linux__
-#include <fcntl.h>
#include <linux/oom.h>
static void
_AT_@ -379,6 +379,10 @@ main(int argc, char **argv) {
if (argc > 0) {
pid_t pid;
extern char **environ;
+ int xfd = ConnectionNumber(dpy);
+ int flags = fcntl(xfd, F_GETFD);
+ if (flags >= 0)
+ fcntl(xfd, F_SETFD, flags | FD_CLOEXEC);
int err = posix_spawnp(&pid, argv[0], NULL, NULL, argv, environ);
if (err) {
die("slock: failed to execute post-lock command: %s: %s\n",
--
2.49.0
Received on Wed Apr 23 2025 - 18:26:36 CEST
This archive was generated by hypermail 2.3.0 : Wed Apr 23 2025 - 18:36:40 CEST