X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fhostname-setup.c;h=6664e8952c2b30de430f4b241d0d307f78e30a87;hb=b57b06258e0b1894edb6d1fc52a80b3c33164892;hp=74ff64883f51d5224c046cb0fdfc618c88a514f2;hpb=0a1beeb64207eaa88ab9236787b1cbc2f704ae14;p=elogind.git diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c index 74ff64883..6664e8952 100644 --- a/src/core/hostname-setup.c +++ b/src/core/hostname-setup.c @@ -64,7 +64,7 @@ int hostname_setup(void) { if (r == -ENOENT) enoent = true; else - log_warning_errno(-r, "Failed to read configured hostname: %m"); + log_warning_errno(r, "Failed to read configured hostname: %m"); hn = NULL; } else @@ -82,10 +82,8 @@ int hostname_setup(void) { hn = "localhost"; } - if (sethostname_idempotent(hn) < 0) { - log_warning("Failed to set hostname to <%s>: %m", hn); - return -errno; - } + if (sethostname_idempotent(hn) < 0) + return log_warning_errno(errno, "Failed to set hostname to <%s>: %m", hn); log_info("Set hostname to <%s>.", hn); return 0;