ptsname may set errno, so avoid saving and restoring errno across the
function.

PR:		standards/171572
This commit is contained in:
Ed Maste 2012-09-12 17:54:09 +00:00
parent 7877ed7ce3
commit 6cbb6bbb77
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240412
2 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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);
}