From 7782e0a0eab136b72d6d0cf27aca85e3fe6a8728 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 7 Dec 2018 16:51:39 +0100 Subject: [PATCH] hostnamed: always flush nscd cache when changing hostname This way we know that nss-myhostname always serves the correct answer. --- src/hostname/hostnamed.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index c1f9e27523..7494cd0c2d 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -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; } -- 2.25.1