settings: remove unnecessary "file" field for hostname from NMSettingPrivate

(cherry picked from commit d6e7fa164b)
This commit is contained in:
Thomas Haller 2016-04-27 14:14:00 +02:00
parent 9ebc6e1157
commit 51188fb046

View file

@ -157,7 +157,6 @@ typedef struct {
struct { struct {
char *value; char *value;
char *file;
GFileMonitor *monitor; GFileMonitor *monitor;
GFileMonitor *dhcp_monitor; GFileMonitor *dhcp_monitor;
gulong monitor_id; gulong monitor_id;
@ -589,11 +588,11 @@ nm_settings_get_hostname (NMSettings *self)
#endif #endif
#if defined(HOSTNAME_PERSIST_GENTOO) #if defined(HOSTNAME_PERSIST_GENTOO)
hostname = read_hostname_gentoo (priv->hostname.file); hostname = read_hostname_gentoo (HOSTNAME_FILE);
#elif defined(HOSTNAME_PERSIST_SLACKWARE) #elif defined(HOSTNAME_PERSIST_SLACKWARE)
hostname = read_hostname_slackware (priv->hostname.file); hostname = read_hostname_slackware (HOSTNAME_FILE);
#else #else
if (g_file_get_contents (priv->hostname.file, &hostname, NULL, NULL)) if (g_file_get_contents (HOSTNAME_FILE, &hostname, NULL, NULL))
g_strchomp (hostname); g_strchomp (hostname);
#endif #endif
@ -1635,7 +1634,7 @@ write_hostname (NMSettingsPrivate *priv, const char *hostname)
char *hostname_eol; char *hostname_eol;
gboolean ret; gboolean ret;
gs_free_error GError *error = NULL; gs_free_error GError *error = NULL;
const char *file = priv->hostname.file; const char *file = HOSTNAME_FILE;
gs_free char *link_path = NULL; gs_free char *link_path = NULL;
gs_unref_variant GVariant *var = NULL; gs_unref_variant GVariant *var = NULL;
struct stat file_stat; struct stat file_stat;
@ -2205,11 +2204,10 @@ setup_hostname_file_monitors (NMSettings *self)
GFileMonitor *monitor; GFileMonitor *monitor;
GFile *file; GFile *file;
priv->hostname.file = HOSTNAME_FILE;
priv->hostname.value = nm_settings_get_hostname (self); priv->hostname.value = nm_settings_get_hostname (self);
/* monitor changes to hostname file */ /* monitor changes to hostname file */
file = g_file_new_for_path (priv->hostname.file); file = g_file_new_for_path (HOSTNAME_FILE);
monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL); monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_object_unref (file); g_object_unref (file);
if (monitor) { if (monitor) {