about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2012-04-05 00:35:19 +0200
committerThomas Schwinge <thomas@codesourcery.com>2012-04-05 00:35:19 +0200
commitd653abb723919fb11f8573cdedf65505c0eca55f (patch)
tree0e7d519e2dd8673c4136531d8773fe7f0efb0453
parentc3b1bf7d8581ac097f06346f0b279fdca92fb6b1 (diff)
downloadglibc-d653abb723919fb11f8573cdedf65505c0eca55f.tar.gz
glibc-d653abb723919fb11f8573cdedf65505c0eca55f.tar.xz
glibc-d653abb723919fb11f8573cdedf65505c0eca55f.zip
[BZ #12340] Fix return code of the Hurd's ttyname_r.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/mach/hurd/ttyname_r.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fe55856a6..dd4a520e1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-04-05  Simon Josefsson  <simon@josefsson.org>
+
+	[BZ #12340]
+	* sysdeps/mach/hurd/ttyname_r.c (__ttyname_r): Return ERANGE instead of
+	EINVAL when BUFLEN is too smal.
+
 2012-04-05  Thomas Schwinge  <thomas@codesourcery.com>
 
 	[BZ #13553]
diff --git a/sysdeps/mach/hurd/ttyname_r.c b/sysdeps/mach/hurd/ttyname_r.c
index 1408ccb3f0..5e5c054e97 100644
--- a/sysdeps/mach/hurd/ttyname_r.c
+++ b/sysdeps/mach/hurd/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994,1995,1996,1998,2010 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2012 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
@@ -42,7 +42,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   len = strlen (nodename) + 1;
   if (len > buflen)
     {
-      errno = EINVAL;
+      errno = ERANGE;
       return errno;
     }