Last change
on this file was 337, checked in by coas-nagasima, 6 years ago |
ASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
538 bytes
|
Rev | Line | |
---|
[337] | 1 | #include <stdio.h>
|
---|
| 2 | #include <fcntl.h>
|
---|
| 3 | #include "stdio_impl.h"
|
---|
| 4 |
|
---|
| 5 | #define MAXTRIES 100
|
---|
| 6 |
|
---|
| 7 | char *__randname(char *);
|
---|
| 8 |
|
---|
| 9 | FILE *tmpfile(void)
|
---|
| 10 | {
|
---|
| 11 | char s[] = "/tmp/tmpfile_XXXXXX";
|
---|
| 12 | int fd;
|
---|
| 13 | FILE *f;
|
---|
| 14 | int try;
|
---|
| 15 | for (try=0; try<MAXTRIES; try++) {
|
---|
| 16 | __randname(s+13);
|
---|
| 17 | fd = sys_open(s, O_RDWR|O_CREAT|O_EXCL, 0600);
|
---|
| 18 | if (fd >= 0) {
|
---|
| 19 | #ifdef SYS_unlink
|
---|
| 20 | __syscall(SYS_unlink, s);
|
---|
| 21 | #else
|
---|
| 22 | __syscall(SYS_unlinkat, AT_FDCWD, s, 0);
|
---|
| 23 | #endif
|
---|
| 24 | f = __fdopen(fd, "w+");
|
---|
| 25 | if (!f) __syscall(SYS_close, fd);
|
---|
| 26 | return f;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 | return 0;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | LFS64(tmpfile);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.