]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamed: always flush nscd cache when changing hostname
authorLennart Poettering <lennart@poettering.net>
Fri, 7 Dec 2018 15:51:39 +0000 (16:51 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Dec 2018 11:10:19 +0000 (12:10 +0100)
This way we know that nss-myhostname always serves the correct answer.

src/hostname/hostnamed.c

index c1f9e27523fa2c2e963a2218b4f278a66856a8c7..7494cd0c2db3c4ec75e16627d20677df77ce1264 100644 (file)
@@ -18,6 +18,7 @@
 #include "id128-util.h"
 #include "main-func.h"
 #include "missing_capability.h"
+#include "nscd-flush.h"
 #include "os-util.h"
 #include "parse-util.h"
 #include "path-util.h"
@@ -286,6 +287,8 @@ static int context_update_kernel_hostname(Context *c) {
         if (sethostname_idempotent(hn) < 0)
                 return -errno;
 
+        (void) nscd_flush_cache(STRV_MAKE("hosts"));
+
         return 0;
 }