From: Jo-Philipp Wich Date: Thu, 5 Sep 2013 12:26:14 +0000 (+0200) Subject: main: only purge uci savedirs if not reloading X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b4649c9fdaa1553cf32fc429eaec99f6ce0fd24a;p=project%2Frpcd.git main: only purge uci savedirs if not reloading --- diff --git a/main.c b/main.c index 9bebd3e..5a608c2 100644 --- a/main.c +++ b/main.c @@ -52,11 +52,13 @@ exec_self(int argc, char **argv) for (i = 0; i < argc; i++) args[i] = argv[i]; + setenv("RPC_HANGUP", "1", 1); execv(cmd, (char * const *)args); } int main(int argc, char **argv) { + const char *hangup; const char *ubus_socket = NULL; int ch; @@ -88,7 +90,12 @@ int main(int argc, char **argv) rpc_uci_api_init(ctx); rpc_plugin_api_init(ctx); - rpc_session_thaw(); + hangup = getenv("RPC_HANGUP"); + + if (!hangup || strcmp(hangup, "1")) + rpc_uci_purge_savedirs(); + else + rpc_session_thaw(); uloop_run(); ubus_free(ctx);