Rev | Line | |
---|
[1] | 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 | |
---|
| 9 | FILE *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 | |
---|
| 18 | FILE *tmpfile(void) __attribute__((weak,alias("tmpfile_unlocked"))); |
---|
Note: See
TracBrowser
for help on using the repository browser.