]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stdio-bridge: fix polled fds
authorJacob McNamee <jacob@jacobmcnamee.com>
Tue, 7 Jan 2025 11:29:31 +0000 (03:29 -0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 7 Jan 2025 18:26:13 +0000 (18:26 +0000)
Poll fds associated with the bus instead of hardcoding stdin/stdout.

This is consequential under socket activation, when the provided fd
should be used instead of stdin/stdout.

(cherry picked from commit 9d1c28b2d8422df700e7d94339ac6052a6755c6c)
(cherry picked from commit 59f5a4323468befbdca2bae7907219eaf8852f9a)

src/stdio-bridge/stdio-bridge.c

index 22570511cbabba9f8189fb27f5b087c799d89d4d..f48b7e574e3dbf340b4a4dda758035e2a806142a 100644 (file)
@@ -236,9 +236,9 @@ static int run(int argc, char *argv[]) {
                 t = usec_sub_unsigned(MIN(timeout_a, timeout_b), now(CLOCK_MONOTONIC));
 
                 struct pollfd p[3] = {
-                        { .fd = fd,            .events = events_a           },
-                        { .fd = STDIN_FILENO,  .events = events_b & POLLIN  },
-                        { .fd = STDOUT_FILENO, .events = events_b & POLLOUT },
+                        { .fd = fd,     .events = events_a           },
+                        { .fd = in_fd,  .events = events_b & POLLIN  },
+                        { .fd = out_fd, .events = events_b & POLLOUT },
                 };
 
                 r = ppoll_usec(p, ELEMENTSOF(p), t);