]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamed: fix return value
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Dec 2020 16:35:22 +0000 (17:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Dec 2020 09:54:57 +0000 (10:54 +0100)
src/hostname/hostnamed.c

index bec1fde5a556aa5e34a0045db9ab13f2fe482d19..e624ace7545203c66135318b16e8ac633cbad803 100644 (file)
@@ -323,6 +323,7 @@ static int context_update_kernel_hostname(
 
         const char *static_hn, *hn;
         struct utsname u;
+        int r;
 
         assert(c);
 
@@ -352,8 +353,9 @@ static int context_update_kernel_hostname(
         else
                 hn = FALLBACK_HOSTNAME;
 
-        if (sethostname_idempotent(hn) < 0)
-                return -errno;
+        r = sethostname_idempotent(hn);
+        if (r < 0)
+                return r;
 
         (void) nscd_flush_cache(STRV_MAKE("hosts"));