Projects
Mega-LLVM:24.03
systemd
_service:tar_scm:resolved-create-etc-resolv.con...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:resolved-create-etc-resolv.conf-symlink-at-runtime.patch of Package systemd
From 0c670fec00f3d5c103d9b7415d4e0510c61ad006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 11 Mar 2016 17:06:17 -0500 Subject: [PATCH] resolved: create /etc/resolv.conf symlink at runtime If the symlink doesn't exists, and we are being started, let's create it to provie name resolution. If it exists, do nothing. In particular, if it is a broken symlink, we cannot really know if the administator configured it to point to a location used by some service that hasn't started yet, so we don't touch it in that case either. https://bugzilla.redhat.com/show_bug.cgi?id=1313085 --- src/resolve/resolved.c | 5 +++++ tmpfiles.d/systemd-resolve.conf | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c index d3bc902..a94d744 100644 --- a/src/resolve/resolved.c +++ b/src/resolve/resolved.c @@ -58,6 +58,11 @@ static int run(int argc, char *argv[]) { if (r < 0) return log_error_errno(r, "Could not create runtime directory: %m"); + r = symlink("../run/systemd/resolve/resolv.conf", "/etc/resolv.conf"); + if (r < 0 && errno != EEXIST) + log_warning_errno(errno, + "Could not create /etc/resolv.conf symlink: %m"); + /* Drop privileges, but keep three caps. Note that we drop two of those too, later on (see below) */ r = drop_privileges(uid, gid, (UINT64_C(1) << CAP_NET_RAW)| /* needed for SO_BINDTODEVICE */ diff --git a/tmpfiles.d/systemd-resolve.conf b/tmpfiles.d/systemd-resolve.conf index cb1c56d..ce3d1a6 100644 --- a/tmpfiles.d/systemd-resolve.conf +++ b/tmpfiles.d/systemd-resolve.conf @@ -6,5 +6,3 @@ # (at your option) any later version. # See tmpfiles.d(5) for details - -L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2