summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2016-11-09 04:01:26 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-08 22:01:26 -0500
commit7debb05dbe1f157e5f07c9bffa98fbe33e1b514e (patch)
treeb9f10bf341eb6d28508e5b7a0788b04b10d8cf52 /src/nspawn
parentaf964954c6a44bd664efe89052ced9584a966baa (diff)
nspawn: fix condition for mounting resolv.conf (#4622)
The file /usr/lib/systemd/resolv.conf can be stale, it does not tell us whether or not systemd-resolved is running or not. So check for /run/systemd/resolve/resolv.conf as well, which is created at runtime and hence is a better indication.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index c8b18bcb88..9b9ae909c9 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1309,7 +1309,8 @@ static int setup_resolv_conf(const char *dest) {
/* Fix resolv.conf, if possible */
where = prefix_roota(dest, "/etc/resolv.conf");
- if (access("/usr/lib/systemd/resolv.conf", F_OK) >= 0) {
+ if (access("/run/systemd/resolve/resolv.conf", F_OK) >= 0 &&
+ access("/usr/lib/systemd/resolv.conf", F_OK) >= 0) {
/* resolved is enabled on the host. In this, case bind mount its static resolv.conf file into the
* container, so that the container can use the host's resolver. Given that network namespacing is
* disabled it's only natural of the container also uses the host's resolver. It also has the big