ttyname_r is specified in POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/ttyname.html>. The error condition "The value of namesize is smaller than the length of the string to be returned" is identified with the error value ERANGE. But sysdeps/mach/hurd/ttyname_r.c returns EINVAL in this case. (Whereas sysdeps/posix/ttyname_r.c and sysdeps/unix/sysv/linux/ttyname_r.c return ERANGE, as expected.) Suggestion: Use ERANGE instead of EINVAL in sysdeps/mach/hurd/ttyname_r.c.
Issue verified. Patch has been posted at <http://sourceware.org/ml/libc-alpha/2011-08/msg00013.html>, now verified. Used in Debian for some time, <http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/hurd-i386/submitted-ttyname_ERANGE.diff>. Roland, OK to commit?
Approved.
Committed in d653abb723919fb11f8573cdedf65505c0eca55f.