From 5be178ca5b770356d0412aff87e4696ff1a1afdf Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 18 Oct 2013 18:41:30 +0200 Subject: daemon: Don't get in a bad state when refresh fails Failure to refresh was supposed to be non-fatal, but since we started putting objects on the bus *after* refresh, we were skipping the registration if refresh failed, as is the case in the UPS test case. --- src/up-device.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/up-device.c b/src/up-device.c index 6d09856..caccb3a 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -690,7 +690,7 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) ret = klass->coldplug (device); if (!ret) { g_debug ("failed to coldplug %s", device->priv->native_path); - goto out; + goto bail; } } @@ -701,7 +701,6 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) /* TODO: refresh should really have separate * success _and_ changed parameters */ - ret = TRUE; goto out; } @@ -711,15 +710,14 @@ up_device_coldplug (UpDevice *device, UpDaemon *daemon, GObject *native) up_history_set_id (device->priv->history, id); g_free (id); } - +out: /* only put on the bus if we succeeded */ ret = up_device_register_device (device); if (!ret) { g_warning ("failed to register device %s", device->priv->native_path); goto out; } - -out: +bail: return ret; } -- cgit v1.2.1