]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
config: only skip "invalid sticky" tests for non-root users
authorSimon Ruderich <simon@ruderich.org>
Sun, 18 Apr 2021 07:42:43 +0000 (09:42 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 18 Apr 2021 07:42:43 +0000 (09:42 +0200)
cmd/safcm/config/files_test.go

index 6124e8ad93b8a2b48eb59ad658b3689251096eeb..da04bf966c5de8ecac9bd74cdab9873e4fbca944 100644 (file)
@@ -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)