summary refs log tree commit diff
path: root/support/temp_file.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-11-12 09:53:06 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-11-12 09:53:06 +0100
commit1ffe1ccb6ec5771765f1f6f0c439ed07bf345d67 (patch)
treea5d96c2270d9f919e4cda3c17649e5cec4ff519e /support/temp_file.c
parent456b40a97f7e867803b2f47f5fcd3f1fa4bc1f6e (diff)
downloadglibc-1ffe1ccb6ec5771765f1f6f0c439ed07bf345d67.tar.gz
glibc-1ffe1ccb6ec5771765f1f6f0c439ed07bf345d67.tar.xz
glibc-1ffe1ccb6ec5771765f1f6f0c439ed07bf345d67.zip
support: Add xstrndup, xunlink, xreadlink, support_create_temp_directory
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