guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/03: shepherd: Mark server socket as SOCK_CLOEXEC.


From: Ludovic Courtès
Subject: [shepherd] 02/03: shepherd: Mark server socket as SOCK_CLOEXEC.
Date: Sun, 28 Aug 2022 11:33:57 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 6373599137886ba8f5e088ce2fdcb730544c38e6
Author: Ludovic Courtès <ludo@gnu.org>
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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]