10 char *__mktemp(char *);
12 int mkstemp(char *template)
14 int fd, retries = 100;
16 if (!__mktemp(template)) return -1;
17 if ((fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600))>=0)
19 if (errno != EEXIST) return -1;
20 /* this is safe because mktemp verified
21 * that we have a valid template string */
22 strcpy(template+strlen(template)-6, "XXXXXX");