diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml index 3308f68e17..6f333acd6f 100644 --- a/man/NetworkManager.conf.xml +++ b/man/NetworkManager.conf.xml @@ -366,8 +366,9 @@ no-auto-default=* a symlink. file: NetworkManager will write /etc/resolv.conf as file. If it finds - a symlink, it will follow the symlink and update the target - instead. + a symlink to an existing target, it will follow the symlink and + update the target instead. If the symlink's target does not exist, + the symlink will be replaced by a file. resolvconf: NetworkManager will run resolvconf to update the DNS configuration. netconfig: NetworkManager will run diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 7430365c14..354520b3a7 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -797,6 +797,10 @@ update_resolv_conf (NMDnsManager *self, GError *local = NULL; if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE) { + /* Note that if /etc/resolv.conf is a dangling symlink, realpath() + * will return %NULL, and thus below we will replace the symlink + * with a file. This is the only case, in which NetworkManager + * replaces an existing symlink with a file.*/ rc_path_real = realpath (rc_path, NULL); if (rc_path_real) rc_path = rc_path_real;