summaryrefslogtreecommitdiff
path: root/src/test/test-fs-util.c
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2020-08-17 12:08:57 +0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-08-17 18:30:24 +0200
commit209650b7200115d2cad9081cb97e22608fce41f8 (patch)
treee5a09e469f704e1787e6e0a882cd7b3084e2d209 /src/test/test-fs-util.c
parentbfeb370abcd9a5468ef565a32189d5593a40ce19 (diff)
downloadsystemd-209650b7200115d2cad9081cb97e22608fce41f8.tar.gz
test-fs-util: skip encrypted path test if we get EACCES
Unprivileged test-fs-util fails on my system since /sys/dev/block is inaccessible for unprivileged users, so let's skip encrypted path test if we get EACCES or similar.
Diffstat (limited to 'src/test/test-fs-util.c')
-rw-r--r--src/test/test-fs-util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
index dfea70ca27..1ea845dd9b 100644
--- a/src/test/test-fs-util.c
+++ b/src/test/test-fs-util.c
@@ -850,11 +850,12 @@ static void test_path_is_encrypted_one(const char *p, int expect) {
int r;
r = path_is_encrypted(p);
- if (r == -ENOENT) /* This might fail, if btrfs is used and we run in a container. In that case we
- * cannot resolve the device node paths that BTRFS_IOC_DEV_INFO returns, because
- * the device nodes are unlikely to exist in the container. But if we can't stat()
- * them we cannot determine the dev_t of them, and thus cannot figure out if they
- * are enrypted. Hence let's just ignore ENOENT here. */
+ if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r)) /* This might fail, if btrfs is used and we run in a
+ * container. In that case we cannot resolve the device node paths that
+ * BTRFS_IOC_DEV_INFO returns, because the device nodes are unlikely to exist in
+ * the container. But if we can't stat() them we cannot determine the dev_t of
+ * them, and thus cannot figure out if they are enrypted. Hence let's just ignore
+ * ENOENT here. Also skip the test if we lack privileges. */
return;
assert_se(r >= 0);