summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/tmpnam.3
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2019-04-26 06:33:29 +0000
committermartijn <martijn@openbsd.org>2019-04-26 06:33:29 +0000
commit01e8f378cfc2c9c54729ba8f77e258e612d84c8b (patch)
treef54a05a9aecb2322b52b5f28dc7894cf3939556e /lib/libc/stdio/tmpnam.3
parentcheck owner and permission of download directory (diff)
downloadwireguard-openbsd-01e8f378cfc2c9c54729ba8f77e258e612d84c8b.tar.xz
wireguard-openbsd-01e8f378cfc2c9c54729ba8f77e258e612d84c8b.zip
Undo changes to tmpfile.c r1.5.
Doing the fchown call causes pledge("tmppath") to be insufficient and the the umask dance may cause race-conditions in multithreaded applications. Also POSIX states the following nowadays: implementations may restrict the permissions, either by clearing the file mode bits or setting them to the value S_IRUSR | S_IWUSR. Encouraging words from tedu@ Standards verification and OK millert@
Diffstat (limited to 'lib/libc/stdio/tmpnam.3')
-rw-r--r--lib/libc/stdio/tmpnam.313
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/libc/stdio/tmpnam.3 b/lib/libc/stdio/tmpnam.3
index ab969a9a61f..5a374d6e1ac 100644
--- a/lib/libc/stdio/tmpnam.3
+++ b/lib/libc/stdio/tmpnam.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmpnam.3,v 1.21 2015/02/28 21:51:57 bentley Exp $
+.\" $OpenBSD: tmpnam.3,v 1.22 2019/04/26 06:33:29 martijn Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: February 28 2015 $
+.Dd $Mdocdate: April 26 2019 $
.Dt TMPFILE 3
.Os
.Sh NAME
@@ -57,15 +57,6 @@ The created file is unlinked before
.Fn tmpfile
returns, causing the file to be automatically deleted when the last
reference to it is closed.
-Since
-.Xr mkstemp 3
-creates the file with mode
-.Dv S_IRUSR | S_IWUSR ,
-after the unlink,
-.Xr fchown 2
-and
-.Xr umask 2
-are used to set the file mode to the expected value.
The file is opened with the access value
.Ql w+ .
.Pp