11 char *__randname(char *);
13 char *mkdtemp(char *template)
15 size_t l = strlen(template);
18 if (l<6 || memcmp(template+l-6, "XXXXXX", 6)) {
24 __randname(template+l-6);
25 if (!mkdir(template, 0700)) return template;
26 } while (--retries && errno == EEXIST);
28 memcpy(template+l-6, "XXXXXX", 6);