projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
include header that declares __syscall_ret where it's defined
[oweals/musl.git]
/
src
/
stdio
/
tmpfile.c
1
#include <stdio.h>
2
#include <fcntl.h>
3
#include <unistd.h>
4
#include "stdio_impl.h"
5
6
#define MAXTRIES 100
7
8
FILE *tmpfile(void)
9
{
10
char buf[L_tmpnam], *s;
11
int fd;
12
FILE *f;
13
int try;
14
for (try=0; try<MAXTRIES; try++) {
15
s = tmpnam(buf);
16
if (!s) return 0;
17
fd = syscall(SYS_open, s, O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600);
18
if (fd >= 0) {
19
f = __fdopen(fd, "w+");
20
__syscall(SYS_unlink, s);
21
return f;
22
}
23
}
24
return 0;
25
}
26
27
LFS64(tmpfile);