summaryrefslogtreecommitdiff
path: root/src/test/test-bpf-foreign-programs.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-14 15:55:16 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-14 17:07:06 +0200
commita626cb15c0a029270779887dc3bc12e2dcadd273 (patch)
tree83ac18a92496e538d2fbe1c85aaccb1ca503b6b0 /src/test/test-bpf-foreign-programs.c
parent63275a70323f2535aa943e47e827ec65a7358f0e (diff)
downloadsystemd-a626cb15c0a029270779887dc3bc12e2dcadd273.tar.gz
basic/log: assert that 0 is not passed as errno, except in test code
Let's assert if we ever happen to pass 0 to one of the log functions. With the preceding commit to return -EIO from log_*(), passing 0 wouldn't affect the return value any more, but it is still most likely an error. The unit test code is an exception: we fairly often pass the return value to print it, before checking what it is. So let's assert that we're not passing 0 in non-test code. As with the previous check for %m, this is only done in developer mode. We are depending on external code setting errno correctly for us, which might not always be true, and which we can't test, so we shouldn't assert, but just handle this gracefully. I did a bunch of greps to try to figure out if there are any places where we're passing 0 on purpose, and couldn't find any. The one place that failed in tests is adjusted. About "zerook" in the name: I wanted the suffix to be unambiguous. It's a single "word" because each of the words in log_full_errno is also meaningful, and having one term use two words would be confusing.
Diffstat (limited to 'src/test/test-bpf-foreign-programs.c')
-rw-r--r--src/test/test-bpf-foreign-programs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test-bpf-foreign-programs.c b/src/test/test-bpf-foreign-programs.c
index e703924077..666317e520 100644
--- a/src/test/test-bpf-foreign-programs.c
+++ b/src/test/test-bpf-foreign-programs.c
@@ -293,7 +293,7 @@ int main(int argc, char *argv[]) {
r = cg_all_unified();
if (r <= 0)
- return log_tests_skipped_errno(r, "Unified hierarchy is required, skipping.");
+ return log_tests_skipped("Unified hierarchy is required, skipping.");
r = enter_cgroup_subroot(NULL);
if (r == -ENOMEDIUM)