diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-10 13:31:58 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-10 18:24:26 +0200 |
commit | 681e39c1dcefa8a7be4617956c9821499c339023 (patch) | |
tree | 457532b75d3801c80290a68855b4518cbf253640 /src/test/test-acl-util.c | |
parent | tests: Improve assertion error messages (diff) | |
download | systemd-681e39c1dcefa8a7be4617956c9821499c339023.tar.xz systemd-681e39c1dcefa8a7be4617956c9821499c339023.zip |
Introduce ASSERT_OK_ERRNO()
ASSERT_OK() is for functions that return negative errno. Let's
introduce ASSERT_OK_ERRNO() for syscalls that return -1 and store
the error in errno.
Diffstat (limited to 'src/test/test-acl-util.c')
-rw-r--r-- | src/test/test-acl-util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-acl-util.c b/src/test/test-acl-util.c index 3cb106a93f..0cc9afcf34 100644 --- a/src/test/test-acl-util.c +++ b/src/test/test-acl-util.c @@ -95,7 +95,7 @@ TEST_RET(fd_acl_make_read_only) { /* make it more exciting */ (void) fd_add_uid_acl_permission(fd, 1, ACL_READ|ACL_WRITE|ACL_EXECUTE); - assert_se(fstat(fd, &st) >= 0); + ASSERT_OK_ERRNO(fstat(fd, &st)); assert_se(FLAGS_SET(st.st_mode, 0200)); cmd = strjoina("getfacl -p ", fn); @@ -107,7 +107,7 @@ TEST_RET(fd_acl_make_read_only) { log_info("read-only"); assert_se(fd_acl_make_read_only(fd)); - assert_se(fstat(fd, &st) >= 0); + ASSERT_OK_ERRNO(fstat(fd, &st)); assert_se((st.st_mode & 0222) == 0000); cmd = strjoina("getfacl -p ", fn); @@ -119,7 +119,7 @@ TEST_RET(fd_acl_make_read_only) { log_info("writable"); assert_se(fd_acl_make_writable(fd)); - assert_se(fstat(fd, &st) >= 0); + ASSERT_OK_ERRNO(fstat(fd, &st)); assert_se((st.st_mode & 0222) == 0200); cmd = strjoina("getfacl -p ", fn); @@ -131,7 +131,7 @@ TEST_RET(fd_acl_make_read_only) { log_info("read-only"); assert_se(fd_acl_make_read_only(fd)); - assert_se(fstat(fd, &st) >= 0); + ASSERT_OK_ERRNO(fstat(fd, &st)); assert_se((st.st_mode & 0222) == 0000); cmd = strjoina("getfacl -p ", fn); |