]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ptyfwd: do not try to read from PTYForward.input_fd when read-only mode
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Aug 2025 06:46:04 +0000 (15:46 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 18 Aug 2025 12:05:12 +0000 (13:05 +0100)
Fixes the following error message (the last line):
```
[FAILED] Failed to start TEST-60-MOUNT-RATELIMIT.service.
Sending SIGTERM to remaining processes...
Sending SIGKILL to remaining processes...
All filesystems, swaps, loop devices, MD devices and DM devices detached.
Exiting container.
Failed to read from pty input fd: Bad file descriptor
```

Follow-up for b823809bca6cd531a54fcf0f02427aea7cd3e651 and
cf89e48028ed3b651f63ba624175394c3c0d8efa.

src/shared/ptyfwd.c

index 2b1154f5fa138383f29433eca28b7e97fc74c997..46151ee21b962897d91663687903865e5979d72b 100644 (file)
@@ -810,7 +810,7 @@ static int shovel_force(PTYForward *f) {
 
         if (!f->master_hangup)
                 f->master_writable = f->master_readable = true;
-        if (!f->stdin_hangup)
+        if (!f->stdin_hangup && f->input_fd >= 0)
                 f->stdin_readable = true;
         if (!f->stdout_hangup)
                 f->stdout_writable = true;