summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libstdio/tmpfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/libstdio/tmpfile.c')
-rw-r--r--mdk-stage1/dietlibc/libstdio/tmpfile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mdk-stage1/dietlibc/libstdio/tmpfile.c b/mdk-stage1/dietlibc/libstdio/tmpfile.c
new file mode 100644
index 000000000..b20d8410d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/tmpfile.c
@@ -0,0 +1,12 @@
+#include "dietstdio.h"
+#include <stdlib.h>
+#include <unistd.h>
+
+FILE *tmpfile (void) {
+ int fd;
+ char template[20] = "/tmp/tmpfile-XXXXXX";
+ if ((fd=mkstemp(template))<0)
+ return 0;
+ unlink(template);
+ return __stdio_init_file(fd,1);
+}