summaryrefslogtreecommitdiffstats
path: root/src/test/test-acl-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-11 22:25:25 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-12 08:12:36 +0200
commite742ec6abc0ba5da49d5a66592c3922df7d20f4c (patch)
treebda73f769e444beaad5e1be1755f3b8793d0ee02 /src/test/test-acl-util.c
parentmkosi: include libfido2 in fedora mkosi image (diff)
downloadsystemd-e742ec6abc0ba5da49d5a66592c3922df7d20f4c.tar.xz
systemd-e742ec6abc0ba5da49d5a66592c3922df7d20f4c.zip
test-acl-util: skip test if /tmp doesn't do ACLs
Fixes: #17013
Diffstat (limited to 'src/test/test-acl-util.c')
-rw-r--r--src/test/test-acl-util.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/test-acl-util.c b/src/test/test-acl-util.c
index 00c482efed..08764faa4f 100644
--- a/src/test/test-acl-util.c
+++ b/src/test/test-acl-util.c
@@ -6,13 +6,15 @@
#include <unistd.h>
#include "acl-util.h"
+#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "string-util.h"
+#include "tests.h"
#include "tmpfile-util.h"
#include "user-util.h"
-static void test_add_acls_for_user(void) {
+static int test_add_acls_for_user(void) {
char fn[] = "/tmp/test-empty.XXXXXX";
_cleanup_close_ int fd = -1;
char *cmd;
@@ -42,6 +44,9 @@ static void test_add_acls_for_user(void) {
uid = getuid();
r = fd_add_uid_acl_permission(fd, uid, ACL_READ);
+ if (ERRNO_IS_NOT_SUPPORTED(r))
+ return log_tests_skipped("no ACL support on /tmp");
+
log_info_errno(r, "fd_add_uid_acl_permission(%i, "UID_FMT", ACL_READ): %m", fd, uid);
assert_se(r >= 0);
@@ -62,11 +67,10 @@ static void test_add_acls_for_user(void) {
cmd = strjoina("getfacl -p ", fn);
assert_se(system(cmd) == 0);
- unlink(fn);
+ (void) unlink(fn);
+ return 0;
}
int main(int argc, char **argv) {
- test_add_acls_for_user();
-
- return 0;
+ return test_add_acls_for_user();
}