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 2008-08-06 "" "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 ÍÄÃÕ¤Ê¥×¥í¥°¥é¥Þ¤Ï¤³¤Îʸ»úÎ󤬰ì»þ¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ë̾¤È¤·¤Æ
62 Ŭ¤·¤Æ¤¤¤ë¤È¹Í¤¨¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
65 ¤¬ NULL ¤Ê¤é¡¢¤³¤Î̾Á°¤ÏÆâÉô¤ÎÀÅŪ¥Ð¥Ã¥Õ¥¡¤ËºîÀ®¤µ¤ì¡¢
68 ´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿»þ¤Ë¾å½ñ¤¤µ¤ì¤ë¡£
71 .\"O is not NULL, the name is copied to the character array (of length
78 .\"O is returned in case of success.
80 ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð¡¢¥Õ¥¡¥¤¥ë̾¤Ï
84 ¤ÎŤµ¤ò»ý¤Ä) ʸ»úÇÛÎó¤Ë¥³¥Ô¡¼¤µ¤ì¡¢
89 .\"O The pathname that is created, has a directory prefix
91 ºîÀ®¤µ¤ì¤ë¥Ñ¥¹Ì¾¤Ï¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ÎÉôʬ¤Ë
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.
122 ¥¨¥é¡¼¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
123 .\"O .SH "CONFORMING TO"
125 SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
126 .\"O POSIX.1-2008 marks
131 ¤òÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
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 ¤³¤ì¤Ï¥»¥¥å¥ê¥Æ¥£¥Û¡¼¥ë¤Ë¤Ä¤Ê¤¬¤ë²ÄǽÀ¤¬¤¢¤ë¡£
177 ¤½¤Î¤è¤¦¤Ê²ÄǽÀ¤ò²óÈò¤¹¤ë¤¿¤á¤Ë¤Ï¡¢
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
199 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢
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.
218 ¤ò»È¤¦¤³¤È¤òÄó°Æ¤·¤Æ¤¤¤ë¡£
219 ¤³¤Î´Ø¿ô¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
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,
238 .\"O before including
240 ¿ô¤Ï¾¯¤Ê¤¤¤¬¡¢¤³¤Î´Ø¿ô¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¤â¤¢¤ë¡£
241 ¤³¤Î´Ø¿ô¤Î glibc ¤Î¥×¥í¥È¥¿¥¤¥×¤ò»È¤¦¤Ë¤Ï¡¢
243 ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ëÁ°¤Ë
247 ¤òÄêµÁ¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ë¡£
250 .\"O Never use this function.
256 ·è¤·¤Æ¤³¤Î´Ø¿ô¤ò»È¤Ã¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£Âå¤ï¤ê¤Ë