ifcfg-rh: use svSetValueInt64_cond() in write_connection_setting()

This commit is contained in:
Thomas Haller 2017-11-02 10:12:59 +01:00
parent 2730dc60de
commit 6705c71263

View file

@ -1721,6 +1721,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
GString *str;
const char *master, *master_iface = NULL, *type;
gint vint;
guint32 vuint32;
const char *tmp;
svSetValueStr (ifcfg, "NAME", nm_setting_connection_get_id (s_con));
@ -1730,16 +1731,14 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
svSetValueBoolean (ifcfg, "ONBOOT", nm_setting_connection_get_autoconnect (s_con));
vint = nm_setting_connection_get_autoconnect_priority (s_con);
if (vint != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT)
svSetValueInt64 (ifcfg, "AUTOCONNECT_PRIORITY", vint);
else
svUnsetValue (ifcfg, "AUTOCONNECT_PRIORITY");
svSetValueInt64_cond (ifcfg, "AUTOCONNECT_PRIORITY",
vint != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT,
vint);
vint = nm_setting_connection_get_autoconnect_retries (s_con);
if (vint != -1)
svSetValueInt64 (ifcfg, "AUTOCONNECT_RETRIES", vint);
else
svUnsetValue (ifcfg, "AUTOCONNECT_RETRIES");
svSetValueInt64_cond (ifcfg, "AUTOCONNECT_RETRIES",
vint != -1,
vint);
/* Only save the value for master connections */
type = nm_setting_connection_get_connection_type (s_con);
@ -1855,11 +1854,10 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
g_string_free (str, TRUE);
}
if (nm_setting_connection_get_gateway_ping_timeout (s_con)) {
svSetValueInt64 (ifcfg, "GATEWAY_PING_TIMEOUT",
nm_setting_connection_get_gateway_ping_timeout (s_con));
} else
svUnsetValue (ifcfg, "GATEWAY_PING_TIMEOUT");
vuint32 = nm_setting_connection_get_gateway_ping_timeout (s_con);
svSetValueInt64_cond (ifcfg, "GATEWAY_PING_TIMEOUT",
vuint32 != 0,
vuint32);
switch (nm_setting_connection_get_metered (s_con)) {
case NM_METERED_YES: