1 .\" Copyright (c) 1999 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 1997-2000 Kazuyuki Tanisako and NAKANO Takeo
24 .\" all rights reserved.
25 .\" Translated 1997-05-17, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
26 .\" Modified 1997-05-27, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
27 .\" Modified 1998-02-04, Kazuyuki Tanisako <tanisako@osa.dec-j.co.jp>
28 .\" Updated and Modified 2000-10-12, NAKANO Takeo <nakano@apm.seikei.ac.jp>
29 .\" Updated 2006-04-14, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.29
30 .\" Updated 2006-07-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
32 .\"WORD: temporary file テンポラリファイル
33 .\"WORD: filename ファイル名
35 .\"WORD: directory ディレクトリ
36 .\"WORD: environment variable 環境変数
39 .\"WORD: pointer ポインター
41 .TH TEMPNAM 3 2008-08-06 "" "Linux Programmer's Manual"
43 tempnam \- テンポラリファイルの名前を作成する
48 .BI "char *tempnam(const char *" dir ", const char *" pfx );
53 .RB ( feature_test_macros (7)
58 _BSD_SOURCE || _SVID_SOURCE
61 関数はファイル名として正しい文字列へのポインターを返す。
64 がチェックした時点においては存在しない (しなかった)。
66 が NULL でない 5 バイト以内の文字列であれば、
70 生成されるディレクトリの部分は、「適切」でなければならない
71 (大抵の場合、「適切」であるためにはまず少なくとも
74 適切なディレクトリの探索は、以下の手順にしたがって行われる。
80 その内容が適切なディレクトリの名前なら、それを用いる。
85 引き数が NULL でない文字列でかつ適切なら、それを用いる。
95 最後に実装で定義されたディレクトリが用いられることになる。
105 関数は他と重ならないテンポラリファイル名へのポインタを返す。
106 他と重ならない名前が生成できなければ NULL を返す。
112 SVr4, 4.3BSD, POSIX.1-2001.
118 は推測が難しい名前を生成するが、それにもかかわらず、
120 がパス名を返してから、プログラムがそのファイルをオープンする
121 までの間に、別のプログラムが同じパス名で、ファイルを
123 で作成したり、シンボリックリンクを作成したりする可能性がある。
124 これはセキュリティホールにつながる可能性がある。
129 フラグを使ってパス名をオープンすればよい。
139 glibc は、プログラムが set-user-ID されていない場合に限ってこれを用いる。
140 SVr4 では \fBd)\fP で使用されるディレクトリを
142 と定めている (glibc もこの通りである)。
144 パス名を返すのに使用するメモリを動的に確保するので、
148 はリエントラントであり、スレッドセーフである。
153 回まで、呼び出される度に異なる文字列を作成する
160 回以上呼び出された場合、動作は実装依存である。
167 他と重ならない名前が見つけられなかった場合、glibc の
173 「適切」という言葉の正確な意味は定義されていない。
174 ディレクトリに対してどの程度のアクセス権限が必要なのかは指定されていない。
176 決してこの関数を使ってはならない。代わりに