Loading...
--- Libc/Libc-763.11/stdio/mktemp.3
+++ Libc/Libc-583/stdio/mktemp.3
@@ -9,6 +9,10 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
@@ -26,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.22 2007/01/09 00:28:07 imp Exp $
+.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.20 2004/02/20 04:08:28 green Exp $
.\"
.Dd February 11, 1998
.Dt MKTEMP 3
@@ -34,8 +38,8 @@
.Sh NAME
.Nm mkdtemp ,
.Nm mkstemp ,
-.Nm mkstemps ,
-.Nm mktemp
+.Nm mktemp ,
+.Nm mktemps
.Nd make temporary file name (unique)
.Sh LIBRARY
.Lb libc
@@ -199,6 +203,35 @@
See
.Xr gcc 1
for more information.
+.Sh BUGS
+This family of functions produces filenames which can be guessed,
+though the risk is minimized when large numbers of
+.Ql X Ns s
+are used to
+increase the number of possible temporary filenames.
+This makes the race in
+.Fn mktemp ,
+between testing for a file's existence (in the
+.Fn mktemp
+function call)
+and opening it for use
+(later in the user application)
+particularly dangerous from a security perspective.
+Whenever it is possible,
+.Fn mkstemp
+should be used instead, since it does not have the race condition.
+If
+.Fn mkstemp
+cannot be used, the filename created by
+.Fn mktemp
+should be created using the
+.Dv O_EXCL
+flag to
+.Xr open 2
+and the return status of the call should be tested for failure.
+This will ensure that the program does not continue blindly
+in the event that an attacker has already created the file
+with the intention of manipulating or reading its contents.
.Sh LEGACY SYNOPSIS
.Fd #include <unistd.h>
.Pp
@@ -233,32 +266,3 @@
.Ox 2.4 ,
and later in
.Fx 3.4 .
-.Sh BUGS
-This family of functions produces filenames which can be guessed,
-though the risk is minimized when large numbers of
-.Ql X Ns s
-are used to
-increase the number of possible temporary filenames.
-This makes the race in
-.Fn mktemp ,
-between testing for a file's existence (in the
-.Fn mktemp
-function call)
-and opening it for use
-(later in the user application)
-particularly dangerous from a security perspective.
-Whenever it is possible,
-.Fn mkstemp
-should be used instead, since it does not have the race condition.
-If
-.Fn mkstemp
-cannot be used, the filename created by
-.Fn mktemp
-should be created using the
-.Dv O_EXCL
-flag to
-.Xr open 2
-and the return status of the call should be tested for failure.
-This will ensure that the program does not continue blindly
-in the event that an attacker has already created the file
-with the intention of manipulating or reading its contents.