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