diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-07-05 14:35:05 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-07-05 15:54:40 +0200 |
commit | f7d18b11a1639e1ccce3bc94875255d7aff87d4a (patch) | |
tree | ab2bad93c14525e28eec52be125a7978e48fd1c3 | |
parent | d52ab895eb35c2b13eef55b903b54797dff7d903 (diff) |
main: improve start
1: emits the correct PID even if daemonized
2: run the startup calls before executing the client (if any)
Change-Id: I7e06961d4a88bc6083aa1bc48ccedf57b76ea268
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/main.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -603,15 +603,15 @@ static void start(int signum) goto error; } + /* run the startup calls */ + run_startup_calls(); + /* run the command */ if (execute_command() < 0) goto error; /* ready */ sd_notify(1, "READY=1"); - - /* run the startup calls */ - run_startup_calls(); return; error: exit(1); @@ -631,7 +631,6 @@ int main(int argc, char *argv[]) // ------------- Build session handler & init config ------- config = afb_config_parse_arguments(argc, argv); - INFO("running with pid %d", getpid()); // --------- run ----------- if (config->background) { @@ -642,6 +641,7 @@ int main(int argc, char *argv[]) // ---- in foreground mode -------------------- INFO("entering foreground mode"); } + INFO("running with pid %d", getpid()); /* set the daemon environment */ setup_daemon(); |