From c1dcf6dd102a582d3f286e08f4467a9aa13b93f8 Mon Sep 17 00:00:00 2001 From: Cole Dishington Date: Wed, 29 Nov 2023 13:36:11 +1300 Subject: [PATCH] apteryx-saver: Check for apteryx_query() failure whilst writing config Check for apteryx_query() failure whilst writing config. Apteryx_query() can return NULL if a refresher path included in the query doesn't respond to apteryxd. --- saver.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/saver.c b/saver.c index 905436b..a262492 100644 --- a/saver.c +++ b/saver.c @@ -279,7 +279,14 @@ write_config_process (gpointer arg1) apteryx_free_tree (config_nodes); config_nodes = apteryx_query (saver_nodes); } - _write_config (); + if (config_nodes) + { + _write_config (); + } + else + { + ERROR("Failed to fetch config to write"); + } pthread_mutex_unlock (&config_lock); return G_SOURCE_CONTINUE; }