diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/test-compat.c | 4 | ||||
-rw-r--r-- | common/test.c | 7 | ||||
-rw-r--r-- | common/test.h | 3 |
3 files changed, 9 insertions, 5 deletions
diff --git a/common/test-compat.c b/common/test-compat.c index 8b5d2e6..e1deac8 100644 --- a/common/test-compat.c +++ b/common/test-compat.c @@ -70,7 +70,7 @@ test_getauxval (void) ret = p11_test_run_child (args, true); assert_num_eq (ret, 0); - path = p11_test_copy_setgid (args[0]); + path = p11_test_copy_setgid (args[0], BUILDDIR); if (path == NULL) return; @@ -95,7 +95,7 @@ test_secure_getenv (void) ret = p11_test_run_child (args, true); assert_num_eq (ret, 5); - path = p11_test_copy_setgid (args[0]); + path = p11_test_copy_setgid (args[0], BUILDDIR); if (path == NULL) return; diff --git a/common/test.c b/common/test.c index 3827ab0..9749a91 100644 --- a/common/test.c +++ b/common/test.c @@ -579,7 +579,8 @@ copy_file (const char *input, } char * -p11_test_copy_setgid (const char *input) +p11_test_copy_setgid (const char *input, + const char *tmpdir) { gid_t groups[128]; char *path; @@ -600,7 +601,9 @@ p11_test_copy_setgid (const char *input) return NULL; } - path = strdup (BUILDDIR "/test-setgid.XXXXXX"); + if (asprintf(&path, "%s/test-setgid.XXXXXX", tmpdir) < 0) + assert_not_reached(); + assert (path != NULL); fd = mkstemp (path); diff --git a/common/test.h b/common/test.h index 1c952b0..81b90f6 100644 --- a/common/test.h +++ b/common/test.h @@ -162,7 +162,8 @@ void p11_test_file_delete (const char *directory, #ifdef OS_UNIX -char * p11_test_copy_setgid (const char *path); +char * p11_test_copy_setgid (const char *path, + const char *tmpdir); int p11_test_run_child (const char **argv, bool quiet_out); |