From ebc020cd4f8e2121d6ecc2dfc0cd48c594329cde Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 21 Dec 2024 19:00:22 -0800 Subject: [PATCH] files test: check to skip permissions before testing --- src/platform/files_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/files_test.c b/src/platform/files_test.c index 903bc28bf..c0aa77d02 100644 --- a/src/platform/files_test.c +++ b/src/platform/files_test.c @@ -27,13 +27,13 @@ test_permissions(void) char *file; void *data; size_t n; - temp = nni_plat_temp_dir(); - NUTS_TRUE(temp != NULL); - file = nni_file_join(temp, "nng_files_perms_test"); if (geteuid() == 0) { NUTS_SKIP("Cannot test permissions as root"); return; } + temp = nni_plat_temp_dir(); + NUTS_TRUE(temp != NULL); + file = nni_file_join(temp, "nng_files_perms_test"); NUTS_PASS(nni_file_put(file, "abc", 4)); chmod(file, 0); NUTS_FAIL(nni_file_get(file, &data, &n), NNG_EPERM);