]>
Commit | Line | Data |
---|---|---|
e2bc0d6d | 1 | From 8a2267ab6b37948a70c10f0af781be4822a54c6b Mon Sep 17 00:00:00 2001 |
2 | From: Dan Winship <danw@gnome.org> | |
3 | Date: Thu, 05 Apr 2012 17:30:09 +0000 | |
4 | Subject: Fix a few misc issues noticed by Coverity | |
5 | ||
6 | --- | |
7 | diff --git a/cli/src/settings.c b/cli/src/settings.c | |
8 | index bf42292..3e17891 100644 | |
9 | --- a/cli/src/settings.c | |
10 | +++ b/cli/src/settings.c | |
11 | @@ -607,10 +607,11 @@ vlan_priorities_to_string (NMSettingVlan *s_vlan, NMVlanPriorityMap map) | |
12 | for (i = 0; i < nm_setting_vlan_get_num_priorities (s_vlan, map); i++) { | |
13 | guint32 from, to; | |
14 | ||
15 | - nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to); | |
16 | - g_string_append_printf (priorities, "%d:%d,", from, to); | |
17 | + if (nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to)) | |
18 | + g_string_append_printf (priorities, "%d:%d,", from, to); | |
19 | } | |
20 | - g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */ | |
21 | + if (priorities->len) | |
22 | + g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */ | |
23 | ||
24 | return g_string_free (priorities, FALSE); | |
25 | } | |
26 | diff --git a/libnm-util/nm-setting-vlan.c b/libnm-util/nm-setting-vlan.c | |
27 | index 71760dc..f87ad92 100644 | |
28 | --- a/libnm-util/nm-setting-vlan.c | |
29 | +++ b/libnm-util/nm-setting-vlan.c | |
30 | @@ -460,7 +460,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) | |
31 | return FALSE; | |
32 | } | |
33 | ||
34 | - if (priv->flags & !(NM_VLAN_FLAG_REORDER_HEADERS | | |
35 | + if (priv->flags & ~(NM_VLAN_FLAG_REORDER_HEADERS | | |
36 | NM_VLAN_FLAG_GVRP | | |
37 | NM_VLAN_FLAG_LOOSE_BINDING)) { | |
38 | g_set_error (error, | |
39 | diff --git a/src/nm-device-vlan.c b/src/nm-device-vlan.c | |
40 | index 14be849..b9c9323 100644 | |
41 | --- a/src/nm-device-vlan.c | |
42 | +++ b/src/nm-device-vlan.c | |
43 | @@ -643,17 +643,17 @@ nm_device_vlan_new (const char *udi, const char *iface, NMDevice *parent) | |
44 | g_object_unref (device); | |
45 | return NULL; | |
46 | } | |
47 | - priv->vlan_id = vlan_id; | |
48 | ||
49 | if ( parent_ifindex < 0 | |
50 | || parent_ifindex != nm_device_get_ip_ifindex (parent) | |
51 | - || priv->vlan_id < 0) { | |
52 | + || vlan_id < 0) { | |
53 | nm_log_warn (LOGD_DEVICE, "(%s): VLAN parent ifindex (%d) or VLAN ID (%d) invalid.", | |
54 | iface, parent_ifindex, priv->vlan_id); | |
55 | g_object_unref (device); | |
56 | return NULL; | |
57 | } | |
58 | ||
59 | + priv->vlan_id = vlan_id; | |
60 | priv->parent = g_object_ref (parent); | |
61 | priv->parent_state_id = g_signal_connect (priv->parent, | |
62 | "state-changed", | |
63 | -- | |
64 | cgit v0.9.0.2-2-gbebe |