systemctl: avoid spurious warning about missing reboot-param file

$ reboot -f
Failed to read reboot parameter file: No such file or directory

It seems that the warning on ENOENT was inadvertently introduced in
27c06cb516.

The warning reported in #5646 comes from systemctl, but let's fix the other
call site in the same way too.

Fixes #5646.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-05-30 23:14:31 -04:00
parent 5e354b2252
commit 19fbf49cde
2 changed files with 2 additions and 2 deletions

View file

@ -403,7 +403,7 @@ int main(int argc, char *argv[]) {
_cleanup_free_ char *param = NULL;
r = read_one_line_file("/run/systemd/reboot-param", &param);
if (r < 0)
if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read reboot parameter file: %m");
if (!isempty(param)) {

View file

@ -8260,7 +8260,7 @@ static int halt_now(enum action a) {
_cleanup_free_ char *param = NULL;
r = read_one_line_file("/run/systemd/reboot-param", &param);
if (r < 0)
if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read reboot parameter file: %m");
if (!isempty(param)) {