1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include <stdio.h>
- #include <string.h>
- #include "../misc/internals/tempname.h"
- static char tmpnam_buffer[L_tmpnam];
- char *
- tmpnam (char *s)
- {
-
- char tmpbufmem[L_tmpnam];
- char *tmpbuf = s ?: tmpbufmem;
-
- if (__builtin_expect (__path_search (tmpbuf, L_tmpnam, NULL, NULL, 0),
- 0))
- return NULL;
- if (__builtin_expect (__gen_tempname (tmpbuf, __GT_NOCREATE, 0, 0, 0), 0))
- return NULL;
- if (s == NULL)
- return (char *) memcpy (tmpnam_buffer, tmpbuf, L_tmpnam);
- return s;
- }
|