1 .\" Copyright (c) 1999 Andries Brouwer (aeb@cwi.nl)
2 .\" Japanese Version Copyright 1997 Tenkou N. Hattori <tnh@alpsmap.co.jp>
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" 2003-11-15, aeb, added tmpnam_r
26 .\" Japanese Version Copyright (c) 1997 Tenkou N. Hattori
27 .\" all rights reserved.
28 .\" Translated 1997-01-18, Tenkou N. Hattori <tnh@alpsmap.co.jp>
29 .\" Updated 2000-03-15, Kentaro Shirakata <argrath@yo.rim.or.jp>
30 .\" Updated 2005-03-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\" Updated 2006-07-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
33 .TH TMPNAM 3 2010-09-10 "" "Linux Programmer's Manual"
36 .\"O tmpnam, tmpnam_r \- create a name for a temporary file
37 tmpnam, tmpnam_r \- 一時ファイルの名前を作成する
43 .BI "char *tmpnam(char *" s );
49 .\"O function returns a pointer to a string that is a valid filename,
50 .\"O and such that a file with this name did not exist at some point
51 .\"O in time, so that naive programmers may think it
52 .\"O a suitable name for a temporary file.
55 .\"O is NULL this name is generated in an internal static buffer
56 .\"O and may be overwritten by the next call to
59 関数は、ファイル名に使える文字列へのポインタを返す。
60 ある時点では同じ名前を持つファイルが存在しないファイル名が返されるので、
61 幼稚なプログラマはこの文字列が一時ファイルのファイル名として
65 が NULL なら、この名前は内部の静的バッファに作成され、
71 .\"O is not NULL, the name is copied to the character array (of length
78 .\"O is returned in case of success.
89 .\"O The pathname that is created, has a directory prefix
102 .\"O mentioned below.)
111 .\"O .SH "RETURN VALUE"
115 .\"O function returns a pointer to a unique temporary
116 .\"O filename, or NULL if a unique name cannot be generated.
118 関数は一意な一時ファイル名へのポインタを返す。
119 一意なファイル名が作成できなかった場合は NULL を返す。
121 .\"O No errors are defined.
123 .\"O .SH "CONFORMING TO"
125 SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
126 .\"O POSIX.1-2008 marks
136 .\"O function generates a different string each time it is called,
140 .\"O If it is called more than
143 .\"O the behavior is implementation defined.
147 回まで、呼び出される度に異なる文字列を作成する。
149 回以上呼び出された場合、その動作は実装依存である。
153 .\"O generates names that are difficult to guess,
154 .\"O it is nevertheless possible that between the time that
156 .\"O returns a pathname, and the time that the program opens it,
157 .\"O another program might create that pathname using
159 .\"O or create it as a symbolic link.
160 .\"O This can lead to security holes.
161 .\"O To avoid such possibilities, use the
164 .\"O flag to open the pathname.
165 .\"O Or better yet, use
168 .\"O .BR tmpfile (3).
170 は推測が難しい名前を生成するが、それにもかかわらず、
172 がパス名を返してから、プログラムがそのファイルをオープンする
173 までの間に、別のプログラムが同じパス名で、ファイルを
175 で作成したり、シンボリックリンクを作成したりする可能性がある。
176 これはセキュリティホールにつながる可能性がある。
181 フラグを使ってパス名をオープンすればよい。
188 .\"O Portable applications that use threads cannot call
190 .\"O with a NULL parameter if either
191 .\"O .B _POSIX_THREADS
193 .\"O .B _POSIX_THREAD_SAFE_FUNCTIONS
195 移植性が必要な、スレッドを使ったアプリケーションでは、
198 .B _POSIX_THREAD_SAFE_FUNCTIONS
201 関数を NULL 引き数で呼び出してはならない。
203 .\"O A POSIX draft proposed to use a function
209 .\"O char *tmpnam_r(char *s) {
210 .\"O return s ? tmpnam(s) : NULL;
215 .\"O apparently as a warning not to use NULL.
220 NULL を使わないようにという警告の意味で NULL を別扱いしている。
227 return s ? tmpnam(s) : NULL;
232 .\"O A few systems implement it.
233 .\"O To get a glibc prototype for this function from
239 .\"O (before including
242 数は少ないが、この関数を実装しているシステムもある。
246 (「どの」ヘッダファイルをインクルードするよりも前に)
253 .\"O Never use this function.
259 決してこの関数を使ってはならない。代わりに