Date: Sun, 8 Feb 2015 22:24:03 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r278413 - in stable/10: contrib/netbsd-tests/lib/libc/gen lib/libc/gen Message-ID: <201502082224.t18MO4lF042148@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Feb 8 22:24:03 2015 New Revision: 278413 URL: https://svnweb.freebsd.org/changeset/base/278413 Log: MFC r278038: ttyname_r(): Return actual error, not always [ENOTTY]. Adjust the test that used to fail because of this bug. PR: 191936 Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c stable/10/lib/libc/gen/ttyname.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sun Feb 8 22:17:20 2015 (r278412) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sun Feb 8 22:24:03 2015 (r278413) @@ -107,9 +107,6 @@ ATF_TC_BODY(ttyname_r_err, tc) ATF_REQUIRE(rv == ERANGE); } -#ifdef __FreeBSD__ - atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936"); -#endif rv = ttyname_r(-1, buf, ttymax); ATF_REQUIRE(rv == EBADF); Modified: stable/10/lib/libc/gen/ttyname.c ============================================================================== --- stable/10/lib/libc/gen/ttyname.c Sun Feb 8 22:17:20 2015 (r278412) +++ stable/10/lib/libc/gen/ttyname.c Sun Feb 8 22:24:03 2015 (r278413) @@ -65,7 +65,7 @@ ttyname_r(int fd, char *buf, size_t len) /* Must be a terminal. */ if (!isatty(fd)) - return (ENOTTY); + return (errno); /* Must have enough room */ if (len <= sizeof(_PATH_DEV)) return (ERANGE); @@ -73,7 +73,7 @@ ttyname_r(int fd, char *buf, size_t len) strcpy(buf, _PATH_DEV); used = strlen(buf); if (fdevname_r(fd, buf + used, len - used) == NULL) - return (ENOTTY); + return (errno == EINVAL ? ERANGE : errno); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502082224.t18MO4lF042148>