From: Yu Watanabe Date: Sat, 25 Nov 2017 12:11:04 +0000 (+0900) Subject: nspawn: adjust path to static resolv.conf to support split usr X-Git-Tag: v236~115^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62b1e758d33c8e05ee695097f94c44f576813233;p=platform%2Fupstream%2Fsystemd.git nspawn: adjust path to static resolv.conf to support split usr Fixes #7302. --- diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d6e4ec2..63a55e8 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -108,6 +108,12 @@ #include "user-util.h" #include "util.h" +#if HAVE_SPLIT_USR +#define STATIC_RESOLV_CONF "/lib/systemd/resolv.conf" +#else +#define STATIC_RESOLV_CONF "/usr/lib/systemd/resolv.conf" +#endif + /* nspawn is listening on the socket at the path in the constant nspawn_notify_socket_path * nspawn_notify_socket_path is relative to the container * the init process in the container pid can send messages to nspawn following the sd_notify(3) protocol */ @@ -1406,7 +1412,7 @@ static int setup_resolv_conf(const char *dest) { return 0; } - if (access("/usr/lib/systemd/resolv.conf", F_OK) >= 0 && + if (access(STATIC_RESOLV_CONF, F_OK) >= 0 && resolved_listening() > 0) { /* resolved is enabled on the host. In this, case bind mount its static resolv.conf file into the @@ -1418,7 +1424,7 @@ static int setup_resolv_conf(const char *dest) { if (found == 0) /* missing? */ (void) touch(resolved); - r = mount_verbose(LOG_DEBUG, "/usr/lib/systemd/resolv.conf", resolved, NULL, MS_BIND, NULL); + r = mount_verbose(LOG_DEBUG, STATIC_RESOLV_CONF, resolved, NULL, MS_BIND, NULL); if (r >= 0) return mount_verbose(LOG_ERR, NULL, resolved, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_NOSUID|MS_NODEV, NULL); }