summaryrefslogtreecommitdiff
path: root/src/shared/bus-wait-for-jobs.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/shared/bus-wait-for-jobs.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/shared/bus-wait-for-jobs.c')
-rw-r--r--src/shared/bus-wait-for-jobs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/bus-wait-for-jobs.c b/src/shared/bus-wait-for-jobs.c
index e66c8beafa..8458fe8684 100644
--- a/src/shared/bus-wait-for-jobs.c
+++ b/src/shared/bus-wait-for-jobs.c
@@ -306,7 +306,8 @@ int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet, const char* const* extra_ar
if (q < 0 && r == 0)
r = q;
- log_debug_errno(q, "Got result %s/%m for job %s", d->result, d->name);
+ log_full_errno_zerook(LOG_DEBUG, q,
+ "Got result %s/%m for job %s", d->result, d->name);
}
d->name = mfree(d->name);