musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/stdio/tmpfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/tmpfile.c')
-rw-r--r--src/stdio/tmpfile.c 8
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+");
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月10日 18:18:09 +0000

AltStyle によって変換されたページ (->オリジナル) /