Skip to content

Commit

Permalink
files test: check to skip permissions before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Dec 22, 2024
1 parent 7bd6521 commit ebc020c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platform/files_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ebc020c

Please sign in to comment.