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