diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-08-14 21:50:55 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-08-17 19:28:32 +0200 |
commit | 5b5ce6298e5a1c09beacd5c963e2350979cbf94a (patch) | |
tree | 020e119c22b328003ed23eebaf41b606dcbb148c /src/test/test-fs-util.c | |
parent | hwdb: ACCEL_MOUNT_MATRIX quirk for Acer SP111-32* (diff) | |
download | systemd-5b5ce6298e5a1c09beacd5c963e2350979cbf94a.tar.xz systemd-5b5ce6298e5a1c09beacd5c963e2350979cbf94a.zip |
test: accept that char device 0/0 can now be created witout privileges
Fixes: #16721
Diffstat (limited to 'src/test/test-fs-util.c')
-rw-r--r-- | src/test/test-fs-util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index 1ea845dd9b..f2df2e35e6 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -615,8 +615,8 @@ static void test_touch_file(void) { assert_se(timespec_load(&st.st_mtim) == test_mtime); if (geteuid() == 0) { - a = strjoina(p, "/cdev"); - r = mknod(a, 0775 | S_IFCHR, makedev(0, 0)); + a = strjoina(p, "/bdev"); + r = mknod(a, 0775 | S_IFBLK, makedev(0, 0)); if (r < 0 && errno == EPERM && detect_container() > 0) { log_notice("Running in unprivileged container? Skipping remaining tests in %s", __func__); return; @@ -626,17 +626,17 @@ static void test_touch_file(void) { assert_se(lstat(a, &st) >= 0); assert_se(st.st_uid == test_uid); assert_se(st.st_gid == test_gid); - assert_se(S_ISCHR(st.st_mode)); + assert_se(S_ISBLK(st.st_mode)); assert_se((st.st_mode & 0777) == 0640); assert_se(timespec_load(&st.st_mtim) == test_mtime); - a = strjoina(p, "/bdev"); - assert_se(mknod(a, 0775 | S_IFBLK, makedev(0, 0)) >= 0); + a = strjoina(p, "/cdev"); + assert_se(mknod(a, 0775 | S_IFCHR, makedev(0, 0)) >= 0); assert_se(touch_file(a, false, test_mtime, test_uid, test_gid, 0640) >= 0); assert_se(lstat(a, &st) >= 0); assert_se(st.st_uid == test_uid); assert_se(st.st_gid == test_gid); - assert_se(S_ISBLK(st.st_mode)); + assert_se(S_ISCHR(st.st_mode)); assert_se((st.st_mode & 0777) == 0640); assert_se(timespec_load(&st.st_mtim) == test_mtime); } |