summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/mktemp.3
diff options
context:
space:
mode:
authorguenther <>2025-08-04 04:59:31 +0000
committerguenther <>2025-08-04 04:59:31 +0000
commitcc34b672c114e027e8e6bdb0c901bb4b2607ff3f (patch)
treed24aa432577a78ea21d815494fb1cda00d6ef8bc /src/lib/libc/stdlib/mktemp.3
parent97f291299e43eb39dd2ecdc18098d938d467dac6 (diff)
downloadopenbsd-cc34b672c114e027e8e6bdb0c901bb4b2607ff3f.tar.gz
openbsd-cc34b672c114e027e8e6bdb0c901bb4b2607ff3f.tar.bz2
openbsd-cc34b672c114e027e8e6bdb0c901bb4b2607ff3f.zip
Implement the POSIX-2024 close-on-fork flag, but modified to be
reset on exec as preserving it across exec is not necessary for its original purpose and has security and usability concerns. Many thanks to Ricardo Branco (rbranco (at) suse.de) who did an independent implementation, caught that /dev/fd/* needed to be handled, and provided a port of the illumos test suite. Thanks to tb@ for assistance with that. ok deraadt@
Diffstat (limited to 'src/lib/libc/stdlib/mktemp.3')
-rw-r--r--src/lib/libc/stdlib/mktemp.314
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libc/stdlib/mktemp.3 b/src/lib/libc/stdlib/mktemp.3
index 83b7c9eb30..e57ac77717 100644
--- a/src/lib/libc/stdlib/mktemp.3
+++ b/src/lib/libc/stdlib/mktemp.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: mktemp.3,v 1.2 2024/03/01 21:30:40 millert Exp $ 1.\" $OpenBSD: mktemp.3,v 1.3 2025/08/04 04:59:31 guenther Exp $
2.\" 2.\"
3.\" Copyright (c) 1989, 1991, 1993 3.\" Copyright (c) 1989, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.Dd $Mdocdate: March 1 2024 $ 30.Dd $Mdocdate: August 4 2025 $
31.Dt MKTEMP 3 31.Dt MKTEMP 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
@@ -119,6 +119,8 @@ system call:
119Append on each write. 119Append on each write.
120.It Dv O_CLOEXEC 120.It Dv O_CLOEXEC
121Set the close-on-exec flag on the new file descriptor. 121Set the close-on-exec flag on the new file descriptor.
122.It Dv O_CLOFORK
123Set the close-on-fork flag on the new file descriptor.
122.It Dv O_SYNC 124.It Dv O_SYNC
123Perform synchronous I/O operations. 125Perform synchronous I/O operations.
124.El 126.El
@@ -345,18 +347,16 @@ function.
345.Xr tmpnam 3 347.Xr tmpnam 3
346.Sh STANDARDS 348.Sh STANDARDS
347The 349The
348.Fn mkdtemp 350.Fn mkdtemp ,
351.Fn mkostemp ,
349and 352and
350.Fn mkstemp 353.Fn mkstemp
351functions conform to the 354functions conform to the
352.St -p1003.1-2008 355.St -p1003.1-2024
353specification. 356specification.
354The ability to specify more than six 357The ability to specify more than six
355.Em X Ns s 358.Em X Ns s
356is an extension to that standard. 359is an extension to that standard.
357The
358.Fn mkostemp
359function is expected to conform to a future revision of that standard.
360.Pp 360.Pp
361The 361The
362.Fn mktemp 362.Fn mktemp