aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2010-08-03 09:54:22 -0700
committerRoland McGrath <roland@redhat.com>2010-08-03 09:54:22 -0700
commitfd3ebedafc751998b4596d0277a704c41988d10b (patch)
treefebc32b1da59bfa4aaec28a3ec8c93b88ddfe7d9 /sysdeps/mach
parent5a42321d438211210e0869e5e90f8d75d1354e14 (diff)
downloadglibc-fd3ebedafc751998b4596d0277a704c41988d10b.tar
glibc-fd3ebedafc751998b4596d0277a704c41988d10b.tar.gz
glibc-fd3ebedafc751998b4596d0277a704c41988d10b.tar.bz2
glibc-fd3ebedafc751998b4596d0277a704c41988d10b.zip
Hurd: fix ttyname{,_r} errno result for non-ttys
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/ttyname.c8
-rw-r--r--sysdeps/mach/hurd/ttyname_r.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/ttyname.c b/sysdeps/mach/hurd/ttyname.c
index 927851e2e1..6e2e5bf675 100644
--- a/sysdeps/mach/hurd/ttyname.c
+++ b/sysdeps/mach/hurd/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,11 @@ ttyname (int fd)
nodename[0] = '\0';
if (err = HURD_DPORT_USE (fd, __term_get_nodename (port, nodename)))
- return __hurd_dfail (fd, err), NULL;
+ {
+ if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+ err = ENOTTY;
+ return __hurd_dfail (fd, err), NULL;
+ }
return nodename;
}
diff --git a/sysdeps/mach/hurd/ttyname_r.c b/sysdeps/mach/hurd/ttyname_r.c
index 8896252246..5f6c9c35f0 100644
--- a/sysdeps/mach/hurd/ttyname_r.c
+++ b/sysdeps/mach/hurd/ttyname_r.c
@@ -34,7 +34,11 @@ __ttyname_r (int fd, char *buf, size_t buflen)
nodename[0] = '\0';
if (err = HURD_DPORT_USE (fd, __term_get_nodename (port, nodename)))
- return __hurd_dfail (fd, err), errno;
+ {
+ if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+ err = ENOTTY;
+ return __hurd_dfail (fd, err), errno;
+ }
len = strlen (nodename) + 1;
if (len > buflen)