X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/5b2abdfbf4211b6592cdd02b9507555a0ecbb04b..fbd86d4cc20b02a10edcca92fb7ae0a143e63cc4:/stdio/mktemp.3 diff --git a/stdio/mktemp.3 b/stdio/mktemp.3 index b19d61f..0606202 100644 --- a/stdio/mktemp.3 +++ b/stdio/mktemp.3 @@ -30,26 +30,39 @@ .\" SUCH DAMAGE. .\" .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.17 2001/10/01 16:08:59 ru 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 .Os .Sh NAME -.Nm mktemp +.Nm mkdtemp , +.Nm mkstemp , +.Nm mktemp , +.Nm mktemps .Nd make temporary file name (unique) .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In unistd.h .Ft char * -.Fn mktemp "char *template" +.Fo mkdtemp +.Fa "char *template" +.Fc .Ft int -.Fn mkstemp "char *template" +.Fo mkstemps +.Fa "char *template" +.Fa "int suffixlen" +.Fc +.In stdlib.h .Ft int -.Fn mkstemps "char *template" "int suffixlen" +.Fo mkstemp +.Fa "char *template" +.Fc .Ft char * -.Fn mkdtemp "char *template" +.Fo mktemp +.Fa "char *template" +.Fc .Sh DESCRIPTION The .Fn mktemp @@ -94,13 +107,15 @@ function acts the same as except it permits a suffix to exist in the template. The template should be of the form .Pa /tmp/tmpXXXXXXsuffix . +The .Fn mkstemps +function is told the length of the suffix string. .Pp The .Fn mkdtemp function makes the same replacement to the template as in -.Xr mktemp 3 +.Fn mktemp and creates the template directory, mode 0700. .Sh RETURN VALUES The @@ -135,7 +150,7 @@ The pathname portion of the template is not an existing directory. .Pp The .Fn mkstemp , -.Fn mkstemps +.Fn mkstemps , and .Fn mkdtemp functions @@ -169,7 +184,7 @@ A common problem that results in a core dump is that the programmer passes in a read-only string to .Fn mktemp , .Fn mkstemp , -.Fn mkstemps +.Fn mkstemps , or .Fn mkdtemp . This is common with programs that were developed before @@ -217,12 +232,19 @@ 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 +.Pp +The include file +.In unistd.h +is necessary and sufficient for all functions. .Sh SEE ALSO .Xr chmod 2 , .Xr getpid 2 , .Xr mkdir 2 , .Xr open 2 , -.Xr stat 2 +.Xr stat 2 , +.Xr compat 5 .Sh HISTORY A .Fn mktemp