diff options
author | Rob Browning <rlb@defaultvalue.org> | 2025-01-17 11:45:26 -0600 |
---|---|---|
committer | Rob Browning <rlb@defaultvalue.org> | 2025-01-23 12:49:33 -0600 |
commit | 48b1c4eff42d08f4ccd8c574d417c2642d039d1e (patch) | |
tree | 3dd85baeeb9a0429530d18d18285574153b842dd /lib/recvfrom.c | |
parent | 63756efbc5d015a17627fdc446992fc0f7aa6a49 (diff) | |
download | guile-48b1c4eff42d08f4ccd8c574d417c2642d039d1e.tar.gz |
fport_print: handle ttyname ENODEV
In some situations, ttyname may return ENODEV even though isatty is
true. From ttyname(3):
A process that keeps a file descriptor that refers to a pts(4) device
open when switching to another mount namespace that uses a different
/dev/ptmx instance may still accidentally find that a device path of
the same name for that file descriptor exists. However, this device
path refers to a different device and thus can't be used to access the
device that the file descriptor refers to. Calling ttyname() or
ttyname_r() on the file descriptor in the new mount namespace will
cause these functions to return NULL and set errno to ENODEV.
Observed in a Debian riscv64 porterbox schroot.
When ttyname fails with ENODEV, just include the file descriptor integer
value instead. Call ttyname() directly to avoid having to catch the
ENODEV.
* libguile/fports.c (fport_print): fall back to the integer fd when
ttyname() fails with ENODEV.
Diffstat (limited to 'lib/recvfrom.c')
0 files changed, 0 insertions, 0 deletions