6 char *mkdtemp(char *template)
8 size_t l = strlen(template);
11 if (l<6 || memcmp(template+l-6, "XXXXXX", 6)) {
17 __randname(template+l-6);
18 if (!mkdir(template, 0700)) return template;
19 } while (--retries && errno == EEXIST);
21 memcpy(template+l-6, "XXXXXX", 6);