summaryrefslogtreecommitdiff
path: root/src/stdio/tmpfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/tmpfile.c')
-rw-r--r--src/stdio/tmpfile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c
index b0d0ba07..c8569948 100644
--- a/src/stdio/tmpfile.c
+++ b/src/stdio/tmpfile.c
@@ -1,19 +1,19 @@
#include <stdio.h>
#include <fcntl.h>
-#include <unistd.h>
#include "stdio_impl.h"
#define MAXTRIES 100
+char *__randname(char *);
+
FILE *tmpfile(void)
{
- char buf[L_tmpnam], *s;
+ char s[] = "/tmp/tmpfile_XXXXXX";
int fd;
FILE *f;
int try;
for (try=0; try<MAXTRIES; try++) {
- s = tmpnam(buf);
- if (!s) return 0;
+ __randname(s+13);
fd = sys_open(s, O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd >= 0) {
f = __fdopen(fd, "w+");