Fix a few misc issues noticed by Coverity

This commit is contained in:
Dan Winship 2012-04-05 13:30:09 -04:00
parent 6a1208b526
commit 8a2267ab6b
3 changed files with 7 additions and 6 deletions

View file

@ -607,10 +607,11 @@ vlan_priorities_to_string (NMSettingVlan *s_vlan, NMVlanPriorityMap map)
for (i = 0; i < nm_setting_vlan_get_num_priorities (s_vlan, map); i++) {
guint32 from, to;
nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to);
g_string_append_printf (priorities, "%d:%d,", from, to);
if (nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to))
g_string_append_printf (priorities, "%d:%d,", from, to);
}
g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */
if (priorities->len)
g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */
return g_string_free (priorities, FALSE);
}

View file

@ -460,7 +460,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
return FALSE;
}
if (priv->flags & !(NM_VLAN_FLAG_REORDER_HEADERS |
if (priv->flags & ~(NM_VLAN_FLAG_REORDER_HEADERS |
NM_VLAN_FLAG_GVRP |
NM_VLAN_FLAG_LOOSE_BINDING)) {
g_set_error (error,

View file

@ -643,17 +643,17 @@ nm_device_vlan_new (const char *udi, const char *iface, NMDevice *parent)
g_object_unref (device);
return NULL;
}
priv->vlan_id = vlan_id;
if ( parent_ifindex < 0
|| parent_ifindex != nm_device_get_ip_ifindex (parent)
|| priv->vlan_id < 0) {
|| vlan_id < 0) {
nm_log_warn (LOGD_DEVICE, "(%s): VLAN parent ifindex (%d) or VLAN ID (%d) invalid.",
iface, parent_ifindex, priv->vlan_id);
g_object_unref (device);
return NULL;
}
priv->vlan_id = vlan_id;
priv->parent = g_object_ref (parent);
priv->parent_state_id = g_signal_connect (priv->parent,
"state-changed",