discover: Only update our config if the config_set succeeded.
authorJeremy Kerr <jk@ozlabs.org>
Mon, 28 Jul 2014 02:09:49 +0000 (10:09 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 28 Jul 2014 03:52:54 +0000 (11:52 +0800)
If config_set fails, we don't want to send the failed config out to
clients.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c

index e4978faaffd13d4a0c3545d10caf54955062b5c2..22866e6600e29cb869c6196055447fa74b1619f8 100644 (file)
@@ -817,7 +817,12 @@ void device_handler_cancel_default(struct device_handler *handler)
 void device_handler_update_config(struct device_handler *handler,
                struct config *config)
 {
-       config_set(config);
+       int rc;
+
+       rc = config_set(config);
+       if (rc)
+               return;
+
        discover_server_notify_config(handler->server, config);
        device_handler_reinit(handler);
 }