From 0802b101fb40ebfd31ba0ca328da9b0340f6936d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 21 Sep 2007 03:49:28 +0000 Subject: [PATCH] 2007-09-20 Dan Williams * src/nm-device.c - (nm_device_is_activating): work around a race between auto-activation and the user activating the same device that is being auto-activated git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2842 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ src/nm-device.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 38de4116f..e41384f26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-20 Dan Williams + + * src/nm-device.c + - (nm_device_is_activating): work around a race between auto-activation + and the user activating the same device that is being auto-activated + 2007-09-20 Dan Williams * src/nm-device-interface.c diff --git a/src/nm-device.c b/src/nm-device.c index 9b8c58288..a6dae018f 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -1278,6 +1278,8 @@ nm_device_activate (NMDeviceInterface *device, gboolean nm_device_is_activating (NMDevice *device) { + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); switch (nm_device_get_state (device)) { @@ -1291,6 +1293,14 @@ nm_device_is_activating (NMDevice *device) break; } + /* There's a small race between the time when stage 1 is scheduled + * and when the device actually sets STATE_PREPARE when the activation + * handler is actually run. If there's an activation handler scheduled + * we're activating anyway. + */ + if (priv->act_source_id) + return TRUE; + return FALSE; }