From: Simon Ruderich Date: Sun, 18 Apr 2021 07:42:43 +0000 (+0200) Subject: config: only skip "invalid sticky" tests for non-root users X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=5dca1e53d7fa0c2b7c15bbcec5654638727f9009;p=safcm%2Fsafcm.git config: only skip "invalid sticky" tests for non-root users --- diff --git a/cmd/safcm/config/files_test.go b/cmd/safcm/config/files_test.go index 6124e8a..da04bf9 100644 --- a/cmd/safcm/config/files_test.go +++ b/cmd/safcm/config/files_test.go @@ -47,8 +47,8 @@ func TestLoadFiles(t *testing.T) { } // Regular users cannot create sticky files - skipInvalidSticky := runtime.GOOS == "freebsd" || - runtime.GOOS == "openbsd" + skipInvalidSticky := os.Getuid() != 0 && + (runtime.GOOS == "freebsd" || runtime.GOOS == "openbsd") chmod("files-invalid-perm-dir/files", 0500) defer chmod("files-invalid-perm-dir/files", 0700)