Commit 4a8a5495 authored by Thomas Haller's avatar Thomas Haller
Browse files

all: avoid coverity warnings about "Wrong Check of Return Value"

30. NetworkManager-1.9.2/src/settings/plugins/keyfile/nms-keyfile-writer.c:218:
check_return: Calling "g_mkdir_with_parents" without checking return
value (as is done elsewhere 4 out of 5
 times).

25. NetworkManager-1.9.2/src/platform/nm-linux-platform.c:3969:
check_return: Calling "_nl_send_nlmsg" without checking return value (as
is done elsewhere 4 out of 5 times).

34. NetworkManager-1.9.2/src/nm-core-utils.c:2843:
negative_returns: "fd2" is passed to a parameter that cannot be negative.

26. NetworkManager-1.9.2/src/devices/wwan/nm-modem-broadband.c:897:
check_return: Calling "nm_utils_parse_inaddr_bin" without checking
return value (as is done elsewhere 4 out of 5 times).

3. NetworkManager-1.9.2/src/devices/bluetooth/nm-bluez5-manager.c:386:
check_return: Calling "g_variant_lookup" without checking return value
(as is done elsewhere 79 out of 83 times).

16. NetworkManager-1.9.2/libnm-util/nm-setting.c:405:
check_return: Calling "nm_g_object_set_property" without checking return
value (as is done elsewhere 4 out of 5 times).
parent de65d3da
......@@ -402,7 +402,7 @@ nm_setting_new_from_hash (GType setting_type, GHashTable *hash)
continue;
}
nm_g_object_set_property ((GObject *) setting, prop_name, src_value, NULL);
(void) nm_g_object_set_property ((GObject *) setting, prop_name, src_value, NULL);
}
g_type_class_unref (class);
......
......@@ -380,12 +380,12 @@ object_manager_interfaces_added (GDBusProxy *proxy,
if (g_variant_lookup (dict, NM_BLUEZ5_DEVICE_INTERFACE, "a{sv}", NULL))
device_added (proxy, path, self);
if (g_variant_lookup (dict, NM_BLUEZ5_NETWORK_SERVER_INTERFACE, "a{sv}", NULL)) {
GVariant *adapter = g_variant_lookup_value (dict, NM_BLUEZ5_ADAPTER_INTERFACE, G_VARIANT_TYPE_DICTIONARY);
gs_unref_variant GVariant *adapter = g_variant_lookup_value (dict, NM_BLUEZ5_ADAPTER_INTERFACE, G_VARIANT_TYPE_DICTIONARY);
const char *address;
g_variant_lookup (adapter, "Address", "&s", &address);
network_server_added (proxy, path, address, self);
g_variant_unref (adapter);
if ( adapter
&& g_variant_lookup (adapter, "Address", "&s", &address))
network_server_added (proxy, path, address, self);
}
}
......
......@@ -894,7 +894,15 @@ static_stage3_ip4_done (NMModemBroadband *self)
/* Missing gateway not a hard failure */
gw_string = mm_bearer_ip_config_get_gateway (self->_priv.ipv4_config);
nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw);
if ( !gw_string
|| !nm_utils_parse_inaddr_bin (AF_INET, gw_string, &gw)) {
error = g_error_new (NM_DEVICE_ERROR,
NM_DEVICE_ERROR_INVALID_CONNECTION,
"(%s) retrieving IP4 configuration failed: invalid gateway address %s%s%s",
nm_modem_get_uid (NM_MODEM (self)),
NM_PRINT_FMT_QUOTE_STRING (gw_string));
goto out;
}
data_port = mm_bearer_get_interface (self->_priv.bearer);
g_assert (data_port);
......
......@@ -2832,7 +2832,7 @@ nm_utils_fd_get_contents (int fd,
gsize n_have, n_alloc;
int fd2;
if (close_fd)
if (fd_keeper >= 0)
fd2 = nm_steal_fd (&fd_keeper);
else {
fd2 = dup (fd);
......
......@@ -3939,13 +3939,14 @@ do_request_link_no_delayed_actions (NMPlatform *platform, int ifindex, const cha
{
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
int nle;
if (name && !name[0])
name = NULL;
g_return_if_fail (ifindex > 0 || name);
_LOGD ("do-request-link: %d %s", ifindex, name ? name : "");
_LOGD ("do-request-link: %d %s", ifindex, name ?: "");
if (ifindex > 0) {
const NMDedupMultiEntry *entry;
......@@ -3965,8 +3966,15 @@ do_request_link_no_delayed_actions (NMPlatform *platform, int ifindex, const cha
name,
0,
0);
if (nlmsg)
_nl_send_nlmsg (platform, nlmsg, NULL, DELAYED_ACTION_RESPONSE_TYPE_VOID, NULL);
if (nlmsg) {
nle = _nl_send_nlmsg (platform, nlmsg, NULL, DELAYED_ACTION_RESPONSE_TYPE_VOID, NULL);
if (nle < 0) {
_LOGE ("do-request-link: %d %s: failed sending netlink request \"%s\" (%d)",
ifindex, name ?: "",
nl_geterror (nle), -nle);
return;
}
}
}
static void
......
......@@ -213,9 +213,8 @@ _internal_write_connection (NMConnection *connection,
if (!data)
return FALSE;
if (!g_file_test (keyfile_dir, G_FILE_TEST_IS_DIR))
g_mkdir_with_parents (keyfile_dir, 0755);
(void) g_mkdir_with_parents (keyfile_dir, 0755);
/* If we have existing file path, use it. Else generate one from
* connection's ID.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment