mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-08 10:20:30 +01:00
device: avoid removing a list element while iterating it
This commit is contained in:
parent
caa2de563d
commit
833e126cf8
1 changed files with 3 additions and 2 deletions
|
|
@ -8559,12 +8559,13 @@ gboolean
|
|||
nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean assert_is_pending)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
GSList *iter, *next;
|
||||
guint count = 0;
|
||||
|
||||
g_return_val_if_fail (action, FALSE);
|
||||
|
||||
for (iter = priv->pending_actions; iter; iter = iter->next) {
|
||||
for (iter = priv->pending_actions; iter; iter = next) {
|
||||
next = iter->next;
|
||||
if (!strcmp (action, iter->data)) {
|
||||
_LOGD (LOGD_DEVICE, "remove_pending_action (%d): '%s'",
|
||||
count + g_slist_length (iter->next), /* length excluding 'iter' */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue