From 8adfb0eeffd1888f9b53b8d8677eb1656cd20e47 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sat, 18 Nov 2017 14:11:09 +0100 Subject: support_create_temp_directory: Align behavior with create_temp_file create_temp_file automatically supplies the test directory and the XXXXXX suffix. support_create_temp_directory required the caller to specify them, which was confusing. Reviewed-by: Jonathan Nieder --- support/temp_file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'support/temp_file.c') diff --git a/support/temp_file.c b/support/temp_file.c index cbd54e2..547263a 100644 --- a/support/temp_file.c +++ b/support/temp_file.c @@ -89,14 +89,14 @@ create_temp_file (const char *base, char **filename) char * support_create_temp_directory (const char *base) { - char *base_copy = xstrdup (base); - if (mkdtemp (base_copy) == NULL) + char *path = xasprintf ("%s/%sXXXXXX", test_dir, base); + if (mkdtemp (path) == NULL) { - printf ("error: mkdtemp (\"%s\"): %m", base); + printf ("error: mkdtemp (\"%s\"): %m", path); exit (1); } - add_temp_file (base_copy); - return base_copy; + add_temp_file (path); + return path; } /* Helper functions called by the test skeleton follow. */ -- cgit v1.1