version 1.9, 1998/04/13 17:22:10 |
version 1.10, 1998/09/26 19:55:09 |
|
|
flag is given) and the filename is printed |
flag is given) and the filename is printed |
to standard output. |
to standard output. |
.Pp |
.Pp |
.Nm Mktemp |
.Nm mktemp |
is provided to allow shell scripts to safely use temporary files. |
is provided to allow shell scripts to safely use temporary files. |
Traditionally, many shell scripts take the name of the program with |
Traditionally, many shell scripts take the name of the program with |
the pid as a suffix and use that as a temporary file name. This |
the PID as a suffix and use that as a temporary file name. This |
kind of naming scheme is predictable and the race condition it creates |
kind of naming scheme is predictable and the race condition it creates |
is easy for an attacker to win. A safer, though still inferior, approach |
is easy for an attacker to win. A safer, though still inferior approach |
is to make a temporary directory using the same naming scheme. While |
is to make a temporary directory using the same naming scheme. While |
this does allow one to guarantee that a temporary file will not be |
this does allow one to guarantee that a temporary file will not be |
subverted, it still allows a simple denial of service attack. For these |
subverted, it still allows a simple denial of service attack. For these |
|
|
The |
The |
.Nm |
.Nm |
utility |
utility |
exits with a value of 0 on success, and 1 on failure. |
exits with a value of 0 on success or 1 on failure. |
.Sh EXAMPLES |
.Sh EXAMPLES |
The following |
The following |
.Xr sh 1 |
.Xr sh 1 |
|
|
fi |
fi |
.Ed |
.Ed |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr mktemp 3 , |
|
.Xr mkdtemp 3 , |
.Xr mkdtemp 3 , |
.Xr mkstemp 3 |
.Xr mkstemp 3 , |
|
.Xr mktemp 3 |
.Sh HISTORY |
.Sh HISTORY |
The |
The |
.Nm |
.Nm |