summaryrefslogtreecommitdiff
path: root/trust/tests/test-token.c
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-08-26 14:48:59 +0200
committerStef Walter <stef@thewalter.net>2013-08-28 10:59:10 +0200
commitcdad5bceee79afbf8b3440b39c72890d2e67448d (patch)
treef07a8a45fd549a70277e4df9ae783fb996198c7d /trust/tests/test-token.c
parente1042e93488f2b38abeea58b65440111df69afdc (diff)
Avoid multiple stat() calls for same file
As a side effect we can also not use the dirent.d_type field https://bugs.freedesktop.org/show_bug.cgi?id=68525
Diffstat (limited to 'trust/tests/test-token.c')
-rw-r--r--trust/tests/test-token.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/trust/tests/test-token.c b/trust/tests/test-token.c
index bdf1120..a028d9c 100644
--- a/trust/tests/test-token.c
+++ b/trust/tests/test-token.c
@@ -238,9 +238,11 @@ test_not_writable (void)
{
p11_token *token;
- token = p11_token_new (333, "/", "Label");
- assert (!p11_token_is_writable (token));
- p11_token_free (token);
+ if (getuid () != 0) {
+ token = p11_token_new (333, "/", "Label");
+ assert (!p11_token_is_writable (token));
+ p11_token_free (token);
+ }
token = p11_token_new (333, "", "Label");
assert (!p11_token_is_writable (token));
@@ -533,7 +535,7 @@ test_write_new (void)
/* The expected file name */
path = p11_path_build (test.directory, "Yay_.p11-kit", NULL);
- ret = p11_parse_file (test.parser, path, 0);
+ ret = p11_parse_file (test.parser, path, NULL, 0);
assert_num_eq (ret, P11_PARSE_SUCCESS);
free (path);
@@ -573,7 +575,7 @@ test_write_no_label (void)
/* The expected file name */
path = p11_path_build (test.directory, "data.p11-kit", NULL);
- ret = p11_parse_file (test.parser, path, 0);
+ ret = p11_parse_file (test.parser, path, NULL, 0);
assert_num_eq (ret, P11_PARSE_SUCCESS);
free (path);