]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test/test-chown-rec: skip ACL tests if kernel has no ACL support
authorMax Kellermann <max.kellermann@ionos.com>
Mon, 2 Oct 2023 12:05:25 +0000 (14:05 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Mon, 2 Oct 2023 13:32:04 +0000 (15:32 +0200)
The second half of `chown_recursive` works only if the kernel has ACL support.

src/test/test-chown-rec.c

index dcff17efec2b1a1013596971b64db7c4a1f2085f..5d83f5915a439853459817681dc2905c6486f1fc 100644 (file)
@@ -44,6 +44,7 @@ TEST(chown_recursive) {
         const char *p;
         const uid_t uid = getuid();
         const gid_t gid = getgid();
+        int r;
 
         umask(022);
         assert_se(mkdtemp_malloc(NULL, &t) >= 0);
@@ -95,7 +96,11 @@ TEST(chown_recursive) {
 
         /* We now apply an xattr to the dir, and check it again */
         p = strjoina(t, "/dir");
-        assert_se(setxattr(p, "system.posix_acl_access", acl, sizeof(acl), 0) >= 0);
+        r = RET_NERRNO(setxattr(p, "system.posix_acl_access", acl, sizeof(acl), 0));
+        if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
+                return (void) log_tests_skipped_errno(r, "no acl supported on /tmp");
+
+        assert_se(r >= 0);
         assert_se(setxattr(p, "system.posix_acl_default", default_acl, sizeof(default_acl), 0) >= 0);
         assert_se(lstat(p, &st) >= 0);
         assert_se(S_ISDIR(st.st_mode));