---
slock.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/slock.c b/slock.c
index b5a9b04..e77d65c 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -379,11 +379,21 @@ main(int argc, char **argv) {
if (argc > 0) {
pid_t pid;
extern char **environ;
- int err = posix_spawnp(&pid, argv[0], NULL, NULL, argv, environ);
+ posix_spawn_file_actions_t fa;
+ int err = posix_spawn_file_actions_init(&fa);
+ if (err)
+ goto posix_spawnp_failed;
+
+ err = posix_spawn_file_actions_addclose(&fa, ConnectionNumber(dpy));
+ if (err)
+ goto posix_spawnp_failed;
+ err = posix_spawnp(&pid, argv[0], &fa, NULL, argv, environ);
if (err) {
+posix_spawnp_failed:
die("slock: failed to execute post-lock command: %s: %s\n",
argv[0], strerror(err));
}
+ posix_spawn_file_actions_destroy(&fa);
}
/* everything is now blank. Wait for the correct password */
--
2.49.0
Received on Wed Apr 23 2025 - 19:42:36 CEST
This archive was generated by hypermail 2.3.0 : Wed Apr 23 2025 - 19:48:40 CEST