3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

client: add a few return checks

These were caught by static analysis
This commit is contained in:
James Prestwood 2022-03-18 09:44:15 -07:00 committed by Denis Kenzior
parent 064b98e27f
commit d39389afdd

View File

@ -57,24 +57,26 @@ static void get_info_callback(struct l_dbus_message *message, void *user_data)
if (dbus_message_has_error(message)) if (dbus_message_has_error(message))
return; return;
if (!l_dbus_message_get_arguments(message, "a{sv}", &iter)) { if (!l_dbus_message_get_arguments(message, "a{sv}", &iter))
l_error("Failed to parse GetInfo message"); goto parse_failed;
return;
}
while (l_dbus_message_iter_next_entry(&iter, &key, &variant)) { while (l_dbus_message_iter_next_entry(&iter, &key, &variant)) {
if (strcmp(key, "NetworkConfigurationEnabled")) if (strcmp(key, "NetworkConfigurationEnabled"))
continue; continue;
l_dbus_message_iter_get_variant(&variant, "b", if (!l_dbus_message_iter_get_variant(&variant, "b",
&netconfig_enabled); &netconfig_enabled))
goto parse_failed;
break; break;
} }
if (!command_is_interactive_mode()) if (!command_is_interactive_mode())
return; return;
l_dbus_message_get_arguments(message, "a{sv}", &iter); if (!l_dbus_message_get_arguments(message, "a{sv}", &iter))
goto parse_failed;
display("NetworkConfigurationEnabled: %s\n", display("NetworkConfigurationEnabled: %s\n",
netconfig_enabled ? "enabled" : "disabled"); netconfig_enabled ? "enabled" : "disabled");
@ -90,6 +92,12 @@ static void get_info_callback(struct l_dbus_message *message, void *user_data)
display("%s: %s\n", key, sval); display("%s: %s\n", key, sval);
} }
} }
return;
parse_failed:
l_error("Failed to parse GetInfo message");
return;
} }
static bool daemon_get_info(void) static bool daemon_get_info(void)