diff options
author | Thomas Haller <thaller@redhat.com> | 2016-09-09 00:59:21 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-09-09 01:01:30 +0200 |
commit | 8bae6e588ff006eda9ee326026eec08c8bb73f6f (patch) | |
tree | d013c533ecacaccfa79cc967ada78b73513d1bd7 | |
parent | 1a85103765d4eaa0acab6b03658a4f9cfe684a64 (diff) | |
download | NetworkManager-8bae6e588ff006eda9ee326026eec08c8bb73f6f.tar.gz |
ifcfg-rh: remove dead code from write_ip4_setting()
s_ip4 cannot be NULL and fake_ip4 is never TRUE.
Found by Coverity.
Fixes: cf7b8866ced5ec67e76b8dde530e0350104194d4
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index 689af7b93b..dcc48f2acc 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -2010,8 +2010,6 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) gint priority; int timeout; GString *searches; - gboolean success = FALSE; - gboolean fake_ip4 = FALSE; const char *method = NULL; s_ip4 = nm_connection_get_setting_ip4_config (connection); @@ -2075,12 +2073,6 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } - /* Temporarily create fake IP4 setting if missing; method set to DHCP above */ - if (!s_ip4) { - s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new (); - fake_ip4 = TRUE; - } - if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) svSetValue (ifcfg, "BOOTPROTO", "dhcp", FALSE); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) @@ -2255,7 +2247,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (!route_path) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Could not get route file path for '%s'", ifcfg->fileName); - goto out; + return FALSE; } if (utils_has_route_file_new_syntax (route_path)) { @@ -2266,7 +2258,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Could not create route file '%s'", route_path); g_free (route_path); - goto out; + return FALSE; } g_free (route_path); @@ -2317,14 +2309,14 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } if (!svWriteFile (routefile, 0644, error)) { svCloseFile (routefile); - goto out; + return FALSE; } svCloseFile (routefile); } else { write_route_file_legacy (route_path, s_ip4, error); g_free (route_path); if (error && *error) - goto out; + return FALSE; } timeout = nm_setting_ip_config_get_dad_timeout (s_ip4); @@ -2343,13 +2335,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) else svSetValue (ifcfg, "IPV4_DNS_PRIORITY", NULL, FALSE); - success = TRUE; - -out: - if (fake_ip4) - g_object_unref (s_ip4); - - return success; + return TRUE; } static void |