diff mbox series

[hurd,commited] hurd: fix ptsname error when called on a non-tty

Message ID 20200528103808.1117147-1-samuel.thibault@ens-lyon.org
State New
Headers show
Series [hurd,commited] hurd: fix ptsname error when called on a non-tty | expand

Commit Message

Samuel Thibault May 28, 2020, 10:38 a.m. UTC
* sysdeps/mach/hurd/ptsname.c (__ptsname_internal): Replace
not-supported errors from __term_get_peername with ENOTTY.
---
 sysdeps/mach/hurd/ptsname.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
index 87fac8fc28..9627f970f9 100644
--- a/sysdeps/mach/hurd/ptsname.c
+++ b/sysdeps/mach/hurd/ptsname.c
@@ -48,7 +48,11 @@  __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
   error_t err;
 
   if (err = HURD_DPORT_USE (fd, __term_get_peername (port, peername)))
-    return __hurd_dfail (fd, err), errno;
+    {
+      if (err == EMIG_BAD_ID || err == EOPNOTSUPP)
+	err = ENOTTY;
+      return __hurd_dfail (fd, err), errno;
+    }
 
   len = __strnlen (peername, sizeof peername - 1) + 1;
   if (len > buflen)