Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
NetworkManager
NetworkManager
Commits
b3edc86e
Commit
b3edc86e
authored
Feb 05, 2013
by
Jiří Klimeš
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: prevent possible crash if removing devices while nmcli running (bgo #693158)
parent
62bae8ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
cli/src/connections.c
cli/src/connections.c
+6
-3
cli/src/devices.c
cli/src/devices.c
+9
-7
No files found.
cli/src/connections.c
View file @
b3edc86e
...
...
@@ -531,9 +531,12 @@ fill_in_fields_con_status (NMActiveConnection *active, GSList *con_list)
devices
=
nm_active_connection_get_devices
(
active
);
for
(
i
=
0
;
devices
&&
(
i
<
devices
->
len
);
i
++
)
{
NMDevice
*
device
=
g_ptr_array_index
(
devices
,
i
);
const
char
*
dev_iface
=
nm_device_get_iface
(
device
);
g_string_append
(
dev_str
,
nm_device_get_iface
(
device
));
g_string_append_c
(
dev_str
,
','
);
if
(
dev_iface
)
{
g_string_append
(
dev_str
,
dev_iface
);
g_string_append_c
(
dev_str
,
','
);
}
}
if
(
dev_str
->
len
>
0
)
g_string_truncate
(
dev_str
,
dev_str
->
len
-
1
);
/* Cut off last ',' */
...
...
@@ -1087,7 +1090,7 @@ find_device_for_connection (NmCli *nmc,
if
(
iface
)
{
const
char
*
dev_iface
=
nm_device_get_iface
(
dev
);
if
(
!
strcmp
(
dev_iface
,
iface
)
if
(
!
g_
strcmp
0
(
dev_iface
,
iface
)
&&
nm_device_connection_compatible
(
dev
,
connection
,
NULL
))
{
found_device
=
dev
;
}
...
...
cli/src/devices.c
View file @
b3edc86e
...
...
@@ -833,8 +833,10 @@ show_device_info (gpointer data, gpointer user_data)
NMDevice
*
slave
=
g_ptr_array_index
(
slaves
,
idx
);
const
char
*
iface
=
nm_device_get_iface
(
slave
);
g_string_append
(
bond_slaves_str
,
iface
);
g_string_append_c
(
bond_slaves_str
,
' '
);
if
(
iface
)
{
g_string_append
(
bond_slaves_str
,
iface
);
g_string_append_c
(
bond_slaves_str
,
' '
);
}
}
if
(
bond_slaves_str
->
len
>
0
)
g_string_truncate
(
bond_slaves_str
,
bond_slaves_str
->
len
-
1
);
/* Chop off last space */
...
...
@@ -1018,7 +1020,7 @@ do_devices_list (NmCli *nmc, int argc, char **argv)
NMDevice
*
candidate
=
g_ptr_array_index
(
devices
,
i
);
const
char
*
dev_iface
=
nm_device_get_iface
(
candidate
);
if
(
!
strcmp
(
dev_iface
,
iface
))
if
(
!
g_
strcmp
0
(
dev_iface
,
iface
))
device
=
candidate
;
}
if
(
!
device
)
{
...
...
@@ -1182,7 +1184,7 @@ do_device_disconnect (NmCli *nmc, int argc, char **argv)
NMDevice
*
candidate
=
g_ptr_array_index
(
devices
,
i
);
const
char
*
dev_iface
=
nm_device_get_iface
(
candidate
);
if
(
!
strcmp
(
dev_iface
,
iface
))
if
(
!
g_
strcmp
0
(
dev_iface
,
iface
))
device
=
candidate
;
}
...
...
@@ -1321,7 +1323,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
NMDevice
*
candidate
=
g_ptr_array_index
(
devices
,
i
);
const
char
*
dev_iface
=
nm_device_get_iface
(
candidate
);
if
(
!
strcmp
(
dev_iface
,
iface
))
{
if
(
!
g_
strcmp
0
(
dev_iface
,
iface
))
{
device
=
candidate
;
break
;
}
...
...
@@ -1517,7 +1519,7 @@ find_wifi_device_by_iface (const GPtrArray *devices, const char *iface, int *idx
if
(
iface
)
{
/* If a iface was specified then use it. */
if
(
strcmp
(
dev_iface
,
iface
)
==
0
)
{
if
(
g_
strcmp
0
(
dev_iface
,
iface
)
==
0
)
{
device
=
candidate
;
break
;
}
...
...
@@ -1968,7 +1970,7 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv)
NMDevice
*
candidate
=
g_ptr_array_index
(
devices
,
i
);
const
char
*
dev_iface
=
nm_device_get_iface
(
candidate
);
if
(
!
strcmp
(
dev_iface
,
iface
))
{
if
(
!
g_
strcmp
0
(
dev_iface
,
iface
))
{
device
=
candidate
;
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment