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