]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-umount.c
tests: various small fixes for strict systems
[thirdparty/systemd.git] / src / test / test-umount.c
index b27b75b352c519d248b2c966419f92028e432cd8..02852bc089e2aa11f3541250bfc4387098bc429f 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 
 #include "alloc-util.h"
+#include "errno-util.h"
 #include "log.h"
 #include "path-util.h"
 #include "string-util.h"
@@ -36,6 +37,7 @@ static void test_swap_list(const char *fname) {
         _cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head);
         _cleanup_free_ char *testdata_fname = NULL;
         MountPoint *m;
+        int r;
 
         log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps");
 
@@ -45,7 +47,10 @@ static void test_swap_list(const char *fname) {
         }
 
         LIST_HEAD_INIT(mp_list_head);
-        assert_se(swap_list_get(fname, &mp_list_head) >= 0);
+        r = swap_list_get(fname, &mp_list_head);
+        if (ERRNO_IS_PRIVILEGE(r))
+                return;
+        assert_se(r >= 0);
 
         LIST_FOREACH(mount_point, m, mp_list_head)
                 log_debug("path=%s o=%s f=0x%lx try-ro=%s dev=%u:%u",