main: only purge uci savedirs if not reloading

This commit is contained in:
Jo-Philipp Wich 2013-09-05 14:26:14 +02:00
parent fc1b008e08
commit b4649c9fda

9
main.c
View file

@ -52,11 +52,13 @@ exec_self(int argc, char **argv)
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
args[i] = argv[i]; args[i] = argv[i];
setenv("RPC_HANGUP", "1", 1);
execv(cmd, (char * const *)args); execv(cmd, (char * const *)args);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
const char *hangup;
const char *ubus_socket = NULL; const char *ubus_socket = NULL;
int ch; int ch;
@ -88,7 +90,12 @@ int main(int argc, char **argv)
rpc_uci_api_init(ctx); rpc_uci_api_init(ctx);
rpc_plugin_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(); uloop_run();
ubus_free(ctx); ubus_free(ctx);