Blame 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch

47d443
From 86aa208e639b119007332718aa4f453af2a061d0 Mon Sep 17 00:00:00 2001
642812
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
642812
Date: Fri, 11 Mar 2016 17:06:17 -0500
6153dd
Subject: [PATCH] resolved: create /etc/resolv.conf symlink at runtime
642812
642812
If the symlink doesn't exists, and we are being started, let's
642812
create it to provie name resolution.
642812
642812
If it exists, do nothing. In particular, if it is a broken symlink,
642812
we cannot really know if the administator configured it to point to
642812
a location used by some service that hasn't started yet, so we
642812
don't touch it in that case either.
642812
642812
https://bugzilla.redhat.com/show_bug.cgi?id=1313085
642812
---
642812
 src/resolve/resolved.c | 4 ++++
642812
 tmpfiles.d/etc.conf.m4 | 3 ---
642812
 2 files changed, 4 insertions(+), 3 deletions(-)
642812
642812
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
47d443
index f4efddf8e5..3386e3bf67 100644
642812
--- a/src/resolve/resolved.c
642812
+++ b/src/resolve/resolved.c
47d443
@@ -45,6 +45,10 @@ static int run(int argc, char *argv[]) {
47d443
         /* Drop privileges, but only if we have been started as root. If we are not running as root we assume most
3cb114
          * privileges are already dropped. */
3cb114
         if (getuid() == 0) {
3cb114
+                r = symlink("../run/systemd/resolve/resolv.conf", "/etc/resolv.conf");
3cb114
+                if (r < 0 && errno != EEXIST)
3cb114
+                        log_warning_errno(errno,
3cb114
+                                          "Could not create /etc/resolv.conf symlink: %m");
642812
 
3cb114
                 /* Drop privileges, but keep three caps. Note that we drop those too, later on (see below) */
3cb114
                 r = drop_privileges(uid, gid,
642812
diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4
1eeb98
index df8d42101c..928105ea8d 100644
642812
--- a/tmpfiles.d/etc.conf.m4
642812
+++ b/tmpfiles.d/etc.conf.m4
642812
@@ -13,9 +13,6 @@ L+ /etc/mtab - - - - ../proc/self/mounts
642812
 m4_ifdef(`HAVE_SMACK_RUN_LABEL',
642812
 t /etc/mtab - - - - security.SMACK64=_
642812
 )m4_dnl
3cb114
-m4_ifdef(`ENABLE_RESOLVE',
1eeb98
-L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf
642812
-)m4_dnl
642812
 C /etc/nsswitch.conf - - - -
642812
 m4_ifdef(`HAVE_PAM',
642812
 C /etc/pam.d - - - -
47d443
-- 
47d443
2.19.2
47d443