diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 12:51:23 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 17:40:46 +0200 |
commit | c413bb28df0996be99fd6b3f2335dfe8739d62fb (patch) | |
tree | 471627329fda37ea052d798907e079792df541fb /src/update-utmp/update-utmp.c | |
parent | 819528326571f3d5e7fccaf5bc72be6ca00ae78a (diff) | |
download | systemd-c413bb28df0996be99fd6b3f2335dfe8739d62fb.tar.gz |
tree-wide: correct cases where return log_{error,warning} is used without value
In various cases, we would say 'return log_warning()' or 'return log_error()'. Those
functions return 0 if no error is passed in. For log_warning or log_error this doesn't
make sense, and we generally want to propagate the error. In the few cases where
the error should be ignored, I think it's better to split it in two, and call 'return 0'
on a separate line.
Diffstat (limited to 'src/update-utmp/update-utmp.c')
-rw-r--r-- | src/update-utmp/update-utmp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index 47354d5012..4ab90a63ed 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -187,8 +187,10 @@ static int on_runlevel(Context *c) { runlevel = get_current_runlevel(c); if (runlevel < 0) return runlevel; - if (runlevel == 0) - return log_warning("Failed to get new runlevel, utmp update skipped."); + if (runlevel == 0) { + log_warning("Failed to get new runlevel, utmp update skipped."); + return 0; + } if (previous == runlevel) return 0; |