Skip to content

Commit

Permalink
Hurd: fix ttyname{,_r} errno result for non-ttys
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Thibault authored and Roland McGrath committed Aug 3, 2010
1 parent 5a42321 commit fd3ebed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
* hurd/hurdselect.c (_hurd_select): Round timeout up instead of down
when converting to ms.

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.

2010-07-31 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/multiarch/Makefile [subdir=string] (sysdep_routines):
Expand Down
8 changes: 6 additions & 2 deletions sysdeps/mach/hurd/ttyname.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
}
6 changes: 5 additions & 1 deletion sysdeps/mach/hurd/ttyname_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fd3ebed

Please sign in to comment.