]> git.ipfire.org Git - thirdparty/systemd.git/commit
ptyfwd: do not try to read master if already disconnected
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 28 Jul 2025 15:47:45 +0000 (00:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Jul 2025 16:15:29 +0000 (01:15 +0900)
commit446431f5c9f098d86709abfec79a2360856510e4
treed4a473746ccd96e1bb8c8367c79690aab6f807f5
parent7cd26f3560e6879b463b05babcd32c651e586f4e
ptyfwd: do not try to read master if already disconnected

When PTYForward.done is set, the PTYForward.master is already
disconnected. Let's not try to read the already closed file descriptor.

Also, if we previously received vhangup, then it is not necessary to
re-read the device to check vhangup, as we already know.

This also make the check slightly delayed, and use a defer event source,
to make the function can be called safely in another event source.
src/shared/ptyfwd.c