+
+char *
+do_mkdtemp (const char *template)
+{
+ char *writable = strdup (template);
+ if (writable == NULL) {
+ reply_with_perror ("strdup");
+ return NULL;
+ }
+
+ CHROOT_IN;
+ char *r = mkdtemp (writable);
+ CHROOT_OUT;
+
+ if (r == NULL) {
+ reply_with_perror ("mkdtemp: %s", template);
+ free (writable);
+ }
+
+ return r;
+}