summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-05-25 14:58:00 +0200
committerThomas Haller <thaller@redhat.com>2020-06-05 09:17:19 +0200
commit021726e54e9e3006c224bb37de555b663b79c305 (patch)
tree972f99387ba2e88e7a6d74f1badc82576f890ee0
parent8afb8ba819dfb51449f3a01860853affa9c510ef (diff)
downloadNetworkManager-021726e54e9e3006c224bb37de555b663b79c305.tar.gz
keyfile: don't check for info->error before calling handle_warn()
When an error gets set, we should abort right away. We should not come into a situation where we would try to emit another warning. Don't check for a condition that should never happen and assert against it.
-rw-r--r--shared/nm-keyfile/nm-keyfile.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/shared/nm-keyfile/nm-keyfile.c b/shared/nm-keyfile/nm-keyfile.c
index dca946ca8f..5194846422 100644
--- a/shared/nm-keyfile/nm-keyfile.c
+++ b/shared/nm-keyfile/nm-keyfile.c
@@ -91,6 +91,8 @@ _handle_warn (KeyfileReaderInfo *info,
({ \
KeyfileReaderInfo *_info = (arg_info); \
\
+ nm_assert (!_info->error); \
+ \
if (_info->read_handler) { \
_handle_warn (_info, (arg_property_name), (arg_severity), \
g_strdup_printf (__VA_ARGS__)); \
@@ -281,14 +283,12 @@ build_route (KeyfileReaderInfo *info,
metric = u32;
gateway_str = NULL;
} else {
- if (!info->error) {
- handle_warn (info,
- property_name,
- NM_KEYFILE_WARN_SEVERITY_WARN,
- _("ignoring invalid gateway '%s' for %s route"),
- gateway_str,
- family == AF_INET ? "IPv4" : "IPv6");
- }
+ handle_warn (info,
+ property_name,
+ NM_KEYFILE_WARN_SEVERITY_WARN,
+ _("ignoring invalid gateway '%s' for %s route"),
+ gateway_str,
+ family == AF_INET ? "IPv4" : "IPv6");
return NULL;
}
}
@@ -1292,7 +1292,7 @@ ssid_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *key)
if (bytes) {
g_object_set (setting, key, bytes, NULL);
g_bytes_unref (bytes);
- } else if (!info->error) {
+ } else {
handle_warn (info,
key,
NM_KEYFILE_WARN_SEVERITY_WARN,
@@ -1310,7 +1310,7 @@ password_raw_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *ke
if (bytes) {
g_object_set (setting, key, bytes, NULL);
g_bytes_unref (bytes);
- } else if (!info->error) {
+ } else {
handle_warn (info,
key,
NM_KEYFILE_WARN_SEVERITY_WARN,