[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 05/06: service: inetd: Clear O_NONBLOCK on the connection soc
From: |
Ludovic Courtès |
Subject: |
[shepherd] 05/06: service: inetd: Clear O_NONBLOCK on the connection socket. |
Date: |
Mon, 1 Jan 2024 17:38:53 -0500 (EST) |
civodul pushed a commit to branch main
in repository shepherd.
commit 2563bc01bec1a4b1e1c4d9be2e603b22a83aa171
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Jan 1 23:33:07 2024 +0100
service: inetd: Clear O_NONBLOCK on the connection socket.
Fixes a portability issue for GNU/Hurd.
* modules/shepherd/service.scm (make-inetd-constructor): Add ‘fcntl’
calls before calling ‘spawn-child-service’.
---
modules/shepherd/service.scm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 2b8c025..8eac844 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -2088,6 +2088,14 @@ rejecting connection from ~:[~a~;~*local process~].")
(socket-address->string server-address)
(= AF_UNIX (sockaddr:fam client-address))
(socket-address->string client-address))
+
+ ;; On the Hurd, the file descriptor returned by 'accept4'
+ ;; inherits O_NONBLOCK from SOCK. Clear it so the server
+ ;; gets a blocking socket (it doesn't hurt on Linux).
+ (fcntl connection F_SETFL
+ (logand (fcntl connection F_GETFL)
+ (lognot O_NONBLOCK)))
+
(spawn-child-service connection
server-address client-address)))))
(loop))))
- [shepherd] branch main updated (07006e4 -> 520094a), Ludovic Courtès, 2024/01/01
- [shepherd] 02/06: tests: Deal with ‘setrlimit’ behavior on GNU/Hurd., Ludovic Courtès, 2024/01/01
- [shepherd] 01/06: tests: Check whether /proc/*/fd exists before relying on it., Ludovic Courtès, 2024/01/01
- [shepherd] 06/06: support: Update copyright year in ‘--version’ output., Ludovic Courtès, 2024/01/01
- [shepherd] 04/06: service: No SO_REUSEADDR for AF_UNIX sockets., Ludovic Courtès, 2024/01/01
- [shepherd] 03/06: service: Improve handling of the no-PR_SET_CHILD_SUBREAPER case., Ludovic Courtès, 2024/01/01
- [shepherd] 05/06: service: inetd: Clear O_NONBLOCK on the connection socket.,
Ludovic Courtès <=