diff options
| author | Michael Biebl <biebl@debian.org> | 2018-06-17 14:54:10 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-06-17 14:54:10 +0200 |
| commit | 069cb5c3a525ebcc19cc2927964258acaca87b13 (patch) | |
| tree | 66ac6b21a44d630c0fc281c0df327239d491226a /src/dns | |
| parent | 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (diff) | |
New upstream version 1.11.90 upstream/1.11.90
Diffstat (limited to 'src/dns')
| -rw-r--r-- | src/dns/nm-dns-manager.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index f5500ee7..a29fd81f 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -768,8 +768,6 @@ update_resolv_conf (NMDnsManager *self, gs_free char *content = NULL; SpawnResult write_file_result = SR_SUCCESS; int errsv; - const char *rc_path = _PATH_RESCONF; - nm_auto_free char *rc_path_real = NULL; gboolean resconf_link_cached = FALSE; gs_free char *resconf_link = NULL; @@ -794,12 +792,27 @@ update_resolv_conf (NMDnsManager *self, if ( rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE || ( rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK && !_read_link_cached (_PATH_RESCONF, &resconf_link_cached, &resconf_link))) { + gs_free char *rc_path_syml = NULL; + nm_auto_free char *rc_path_real = NULL; + const char *rc_path = _PATH_RESCONF; GError *local = NULL; if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE) { - rc_path_real = realpath (rc_path, NULL); + rc_path_real = realpath (_PATH_RESCONF, NULL); if (rc_path_real) rc_path = rc_path_real; + else { + /* realpath did not resolve a path-name. That either means, + * _PATH_RESCONF: + * - does not exist + * - is a plain file + * - is a dangling symlink + * + * Handle the case, where it is a dangling symlink... */ + rc_path_syml = nm_utils_read_link_absolute (_PATH_RESCONF, NULL); + if (rc_path_syml) + rc_path = rc_path_syml; + } } /* we first write to /etc/resolv.conf directly. If that fails, |