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.

(cherry picked from commit 7f7e1eb60b)
This commit is contained in:
Thomas Haller 2016-04-27 15:03:50 +02:00
parent 51188fb046
commit ddefd6931e

View file

@ -1663,7 +1663,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