Author: emaste
Date: Wed Sep 12 17:54:09 2012
New Revision: 240412
URL: http://svn.freebsd.org/changeset/base/240412

Log:
  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

Modified:
  head/lib/libc/stdlib/ptsname.3
  head/lib/libc/stdlib/ptsname.c

Modified: head/lib/libc/stdlib/ptsname.3
==============================================================================
--- head/lib/libc/stdlib/ptsname.3      Wed Sep 12 17:50:56 2012        
(r240411)
+++ head/lib/libc/stdlib/ptsname.3      Wed Sep 12 17:54:09 2012        
(r240412)
@@ -102,7 +102,8 @@ of the slave device on success; otherwis
 pointer is returned.
 .Sh ERRORS
 The
-.Fn grantpt
+.Fn grantpt ,
+.Fn ptsname
 and
 .Fn unlockpt
 functions may fail and set

Modified: head/lib/libc/stdlib/ptsname.c
==============================================================================
--- head/lib/libc/stdlib/ptsname.c      Wed Sep 12 17:50:56 2012        
(r240411)
+++ head/lib/libc/stdlib/ptsname.c      Wed Sep 12 17:54:09 2012        
(r240412)
@@ -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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to