From: Lennart Poettering Date: Fri, 7 Dec 2018 15:51:39 +0000 (+0100) Subject: hostnamed: always flush nscd cache when changing hostname X-Git-Tag: v240~44^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7782e0a0eab136b72d6d0cf27aca85e3fe6a8728;p=thirdparty%2Fsystemd.git hostnamed: always flush nscd cache when changing hostname This way we know that nss-myhostname always serves the correct answer. --- diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index c1f9e27523f..7494cd0c2db 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; }