summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c10
-rw-r--r--discover/platform.c3
2 files changed, 13 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index b93cdfa..e4978fa 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -285,6 +285,9 @@ struct device_handler *device_handler_init(struct discover_server *server,
parser_init();
+ if (config_get()->safe_mode)
+ return handler;
+
rc = device_handler_init_sources(handler);
if (rc) {
talloc_free(handler);
@@ -842,6 +845,13 @@ static int device_handler_init_sources(struct device_handler *handler)
static void device_handler_reinit_sources(struct device_handler *handler)
{
+ /* if we haven't initialised sources previously (becuase we started in
+ * safe mode), then init once here. */
+ if (!(handler->udev || handler->network || handler->user_event)) {
+ device_handler_init_sources(handler);
+ return;
+ }
+
udev_reinit(handler->udev);
network_shutdown(handler->network);
diff --git a/discover/platform.c b/discover/platform.c
index 3ab6b7b..be60f00 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -43,6 +43,9 @@ static void dump_config(struct config *config)
if (config->network.n_interfaces || config->network.n_dns_servers)
pb_log(" network configuration:\n");
+ if (config->safe_mode)
+ pb_log(" safe mode: active\n");
+
for (i = 0; i < config->network.n_interfaces; i++) {
struct interface_config *ifconf =
config->network.interfaces[i];
OpenPOWER on IntegriCloud