about summary refs log tree commit diff
path: root/support/temp_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'support/temp_file.c')
-rw-r--r--support/temp_file.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/support/temp_file.c b/support/temp_file.c
index fdb2477ab9..cbd54e2e17 100644
--- a/support/temp_file.c
+++ b/support/temp_file.c
@@ -86,6 +86,19 @@ create_temp_file (const char *base, char **filename)
   return fd;
 }
 
+char *
+support_create_temp_directory (const char *base)
+{
+  char *base_copy = xstrdup (base);
+  if (mkdtemp (base_copy) == NULL)
+    {
+      printf ("error: mkdtemp (\"%s\"): %m", base);
+      exit (1);
+    }
+  add_temp_file (base_copy);
+  return base_copy;
+}
+
 /* Helper functions called by the test skeleton follow.  */
 
 void