This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [Hurd] Use ENOTTY error for ttyname/ttyname_r


Samuel Thibault, le Sun 06 Jun 2010 23:03:29 +0200, a écrit :
> ttyname and ttyname_r should rather return ENOTTY when the translator
> does not understand the ttyname RPC.  Makes glibc/io/tst-ttyname_r.c
> pass.

Sorry, I had diffed against an old tree, here is an updated patch.

Samuel

2010-06-06  Samuel Thibault  <samuel.thibault@ens-lyon.org>

        * sysdeps/mach/hurd/ttyname.c (ttyname): Replace MIG_BAD_ID and
        EOPNOTSUPP errors with ENOTTY.
        * sysdeps/mach/hurd/ttyname_r.c (__ttyname_r): Replace MIG_BAD_ID and
        EOPNOTSUPP errors with ENOTTY.

---
 ttyname.c   |    8 ++++++--
 ttyname_r.c |    8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sysdeps/mach/hurd/ttyname.c b/sysdeps/mach/hurd/ttyname.c
index 927851e..6e2e5bf 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 8896252..5f6c9c3 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]