.\" Copyright (C) 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 18:48:06 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Fri Jun 23 01:26:34 1995 by Andries Brouwer (aeb@cwi.nl) .\" (prompted by Scott Burkett ) .\" Modified Sun Mar 28 23:44:38 1999 by Andries Brouwer (aeb@cwi.nl) .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 Kazuyuki Tanisako .\" all rights reserved. .\" Translated Sat Apr 10 02:12:40 JST 1999 .\" by Kazuyuki Tanisako .\" .TH MKTEMP 3 2014\-08\-19 GNU "Linux Programmer's Manual" .SH 名前 mktemp \- 他と重ならないテンポラリファイル名を作成する .SH 書式 .nf \fB#include \fP .sp \fBchar *mktemp(char *\fP\fItemplate\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBmktemp\fP(): .ad l .PD 0 .RS 4 .TP 4 glibc 2.12 以降: _BSD_SOURCE || _SVID_SOURCE || (_XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) && !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600) .TP glibc 2.12 より前: _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .PD .ad b .SH 説明 \fI決してこの関数は使用しないこと\fP。「注意」を参照。 関数 \fBmktemp\fP() は引数 \fItemplate\fP から他と重ならない テンポラリファイル名を作成する。引数 \fItemplate\fP で指示する文字配列 の後6文字は XXXXXX である必要がある。この部分がファイル名を他と 重ならないにするような文字で置き換えられる。 \fItemplate\fP は書き換えられるため、文字列定数ではなく文字配列として宣言するように しなければならない。 .SH 返り値 関数 \fBmktemp\fP() は常に \fItemplate\fP を戻す。 一意な名前が作成された場合、 \fItemplate\fP の最後の 6 バイトに 他と重ならない名前 (それまでに出ていない名前) になるような値が格納される。 一意な名前が作成できなかった場合には、 \fItemplate\fP には空文字列がセットされ、 \fIerrno\fP にエラーを示す値がセットされる。 .SH エラー .TP \fBEINVAL\fP 引数 \fItemplate\fP で指示された文字列の後6文字が XXXXXX でない。 .SH 準拠 .\" .SH NOTES .\" The prototype is in .\" .I .\" for libc4, libc5, glibc1; glibc2 follows the Single UNIX Specification .\" and has the prototype in .\" .IR . 4.3BSD, POSIX.1\-2001. POSIX.1\-2008 では \fBmktemp\fP() の仕様が削除されている。 .SH バグ \fBmktemp\fP() を決して使わないこと。4.3BSD 系の実装や XXXXXX を プロセス ID と1文字により置き換える方式ではせいぜい26の名前を返す ことができるにすぎない。 この名前は簡単に推測できることや、その名前がすでに存在しているかどうか テストして、そのファイルをオープンする間に競合がある事から、 \fBmktemp\fP() を使うのは毎回セキュリティリスクをおかすことになる。 この競合は \fBmkstemp\fP(3) を使うことで避けられる。 .SH 関連項目 \fBmkstemp\fP(3), \fBtempnam\fP(3), \fBtmpfile\fP(3), \fBtmpnam\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。