networkd: fix reporting errors from hostnamed

The return value may be -EINVAL or a positive errno from the dbus
message. Check both ranges, otherwise most errors are silently ignored.
This commit is contained in:
Michael Marineau 2014-07-21 16:23:42 -07:00 committed by Tom Gundersen
parent ea917db9e6
commit 70b34f5de8

View file

@ -835,7 +835,9 @@ static int set_hostname_handler(sd_bus *bus, sd_bus_message *m, void *userdata,
r = sd_bus_message_get_errno(m);
if (r < 0)
log_warning_link(link, "Could not set hostname: %s", strerror(-r));
r = -r;
if (r > 0)
log_warning_link(link, "Could not set hostname: %s", strerror(r));
return 1;
}