source: trunk/sys/dietlibc/tmpfile.c @ 26

Last change on this file since 26 was 1, checked in by alain, 8 years ago

First import

File size: 440 bytes
Line 
1#include "dietstdio.h"
2#include <stdlib.h>
3#include <unistd.h>
4#include <fcntl.h>
5
6/* this is needed so the libpthread wrapper can initialize the mutex,
7 * not to lock it */
8
9FILE *tmpfile_unlocked(void) {
10  int fd;
11  char template[20] = "/tmp/tmpfile-XXXXXX";
12  if ((fd=mkstemp(template))<0)
13    return 0;
14  unlink(template);
15  return __stdio_init_file(fd,1,O_RDWR);
16}
17
18FILE *tmpfile(void) __attribute__((weak,alias("tmpfile_unlocked")));
Note: See TracBrowser for help on using the repository browser.