about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-05-28 10:22:36 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-05-28 10:22:36 +0000
commitc318f663bd417f0477fdbae077c078b2219109b2 (patch)
treeae5aeb02cdcc55a00f6ca1e58b73fc941236d051
parent94884ff506d25ddca4f918c2cd40cc748bc5bbb3 (diff)
downloadglibc-c318f663bd417f0477fdbae077c078b2219109b2.tar.gz
glibc-c318f663bd417f0477fdbae077c078b2219109b2.tar.xz
glibc-c318f663bd417f0477fdbae077c078b2219109b2.zip
hurd: fix ptsname error when called on a non-tty
* sysdeps/mach/hurd/ptsname.c (__ptsname_internal): Replace
not-supported errors from __term_get_peername with ENOTTY.
-rw-r--r--sysdeps/mach/hurd/ptsname.c6
1 files changed, 5 insertions, 1 deletions
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)