civodul pushed a commit to branch master
in repository shepherd.
commit 6373599137886ba8f5e088ce2fdcb730544c38e6
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sun Aug 28 17:31:47 2022 +0200
shepherd: Mark server socket as SOCK_CLOEXEC.
* modules/shepherd.scm (open-server-socket): Add SOCK_CLOEXEC to the
second argument to 'socket'.
---
modules/shepherd.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 61d0402..cbc5eaa 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -44,7 +44,9 @@
(define (open-server-socket file-name)
"Open a socket at FILE-NAME, and listen for connections there."
(with-fluids ((%default-port-encoding "UTF-8"))
- (let ((sock (socket PF_UNIX SOCK_STREAM 0))
+ (let ((sock (socket PF_UNIX
+ (logior SOCK_STREAM SOCK_CLOEXEC)
+ 0))
(address (make-socket-address AF_UNIX file-name)))
(fcntl sock F_SETFL (logior O_NONBLOCK
(fcntl sock F_GETFL)))