From 604c941520bf27ad301e8126cbfd159b15573f27 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 9 Nov 2016 16:48:15 +0100 Subject: resolved: use macro for private resolve.conf Use the macro from header file to have a single definition of the path. --- src/resolve/resolved-resolv-conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index 801014caf5..13f08f8a6c 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -60,7 +60,7 @@ int manager_read_resolv_conf(Manager *m) { return 0; /* Is it symlinked to our own file? */ - if (stat("/run/systemd/resolve/resolv.conf", &own) >= 0 && + if (stat(PRIVATE_RESOLV_CONF, &own) >= 0 && st.st_dev == own.st_dev && st.st_ino == own.st_ino) return 0; -- cgit v1.2.3-54-g00ecf From 01e1bb7f9c5adfb3afbb15f666c363b85ace9e31 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 9 Nov 2016 17:13:28 +0100 Subject: resolved: unlink private resolv.conf on exit This fixes the logic with systemd-nspawn which checks for private resov.conf to decide whether or not to mount it into the container. --- src/resolve/resolved.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c index deb75f9ae5..8d5a5c6b79 100644 --- a/src/resolve/resolved.c +++ b/src/resolve/resolved.c @@ -112,6 +112,10 @@ int main(int argc, char *argv[]) { sd_event_get_exit_code(m->event, &r); finish: + /* systemd-nspawn checks for private resov.conf to decide whether + or not to mount it into the container. So just delete it. */ + (void) unlink(PRIVATE_RESOLV_CONF); + sd_notify(false, "STOPPING=1\n" "STATUS=Shutting down..."); -- cgit v1.2.3-54-g00ecf