aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2012-09-18 13:13:28 +0000
committerEd Maste <emaste@FreeBSD.org>2012-09-18 13:13:28 +0000
commitc7967de6ec775134c04918d7e32fad37a873f7ee (patch)
treecf734003bfcfda7eba0b447f3546d536851af68b
parent3aa37f13ad4823de324bb170dbd11ce9cc46bc66 (diff)
downloadsrc-c7967de6ec775134c04918d7e32fad37a873f7ee.tar.gz
src-c7967de6ec775134c04918d7e32fad37a873f7ee.zip
MFC r240412:
According to a clarification at http://austingroupbugs.net/view.php?id=503 ptsname may set errno, so avoid saving and restoring errno across the function. PR: standards/171572 Approved by: re Sponsored by: ADARA Networks
Notes
Notes: svn path=/releng/9.1/; revision=240648
-rw-r--r--lib/libc/stdlib/ptsname.33
-rw-r--r--lib/libc/stdlib/ptsname.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdlib/ptsname.3 b/lib/libc/stdlib/ptsname.3
index 48da3bd81c26..8e8ec07d1e53 100644
--- a/lib/libc/stdlib/ptsname.3
+++ b/lib/libc/stdlib/ptsname.3
@@ -102,7 +102,8 @@ of the slave device on success; otherwise a
pointer is returned.
.Sh ERRORS
The
-.Fn grantpt
+.Fn grantpt ,
+.Fn ptsname
and
.Fn unlockpt
functions may fail and set
diff --git a/lib/libc/stdlib/ptsname.c b/lib/libc/stdlib/ptsname.c
index 40b140de7610..3e4d4c096ef5 100644
--- a/lib/libc/stdlib/ptsname.c
+++ b/lib/libc/stdlib/ptsname.c
@@ -77,7 +77,6 @@ ptsname(int fildes)
{
static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV;
char *ret = NULL;
- int sverrno = errno;
/* Make sure fildes points to a master device. */
if (__isptmaster(fildes) != 0)
@@ -87,7 +86,6 @@ ptsname(int fildes)
sizeof pt_slave - (sizeof _PATH_DEV - 1)) != NULL)
ret = pt_slave;
-done: /* Make sure ptsname() does not overwrite errno. */
- errno = sverrno;
+done:
return (ret);
}