summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-27 15:03:50 +0200
committerThomas Haller <thaller@redhat.com>2016-04-27 15:03:50 +0200
commit7f7e1eb60b383a1b7b8c46105718748af2b84c66 (patch)
treebc8dc0522bf2cf11c4f458b232635995c97e1c33
parentd6e7fa164bed8d4b7255203ba0856dffbc3e4b1f (diff)
downloadNetworkManager-7f7e1eb60b383a1b7b8c46105718748af2b84c66.tar.gz
settings: fix write_hostname for relative-symbolic links
g_file_read_link() "reads" the symbolic link. If it's a relative path, we get a relative path which is anchored on @file. We must resolve that to be absolute.
-rw-r--r--src/settings/nm-settings.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index 304ac2c39e..b91247a9ae 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -1655,7 +1655,7 @@ write_hostname (NMSettingsPrivate *priv, const char *hostname)
*/
if ( lstat (file, &file_stat) == 0
&& S_ISLNK (file_stat.st_mode)
- && (link_path = g_file_read_link (file, NULL)))
+ && (link_path = nm_utils_read_link_absolute (file, NULL)))
file = link_path;
#if HAVE_SELINUX