diff mbox series

[bug#65221,4/6] service: honor EXTRA-PORTS regardless of log-port and log-file.

Message ID 20230818202239.21177-4-striness@tilde.club
State New
Headers show
Series [bug#65221,1/6] tests: add extra-ports.sh test. | expand

Commit Message

ulfvonbelow Aug. 18, 2023, 8:22 p.m. UTC
EXTRA-PORTS is only honored when either LOG-PORT or LOG-FILE is passed.  I
have no idea why this is the case, it isn't documented anywhere, and it isn't
intuitive.

* modules/shepherd/service.scm (exec-command): Move preserve-ports call
  outside of condition.
---
 modules/shepherd/service.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 68993ac..e816cd1 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1581,11 +1581,7 @@  false."
                                 #o640)
                      (fileno log-port))
                  1)
-           (dup2 1 2)
-
-           ;; Make EXTRA-PORTS available starting from file descriptor 3.
-           ;; This clears their FD_CLOEXEC flag.
-           (reconfigure-fds extra-ports 3))
+           (dup2 1 2))
 
          (lambda (key . args)
            (when log-file
@@ -1594,6 +1590,10 @@  false."
            (print-exception (current-error-port) #f key args)
            (primitive-exit 1))))
 
+     ;; Make EXTRA-PORTS available starting from file descriptor 3.
+     ;; This clears their FD_CLOEXEC flag.
+     (reconfigure-fds extra-ports 3)
+
      ;; setgid must be done *before* setuid, otherwise the user will
      ;; likely no longer have permissions to setgid.
      (when group