Fix error on initialisation
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 2 Jun 2017 12:37:35 +0000 (14:37 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 2 Jun 2017 12:37:35 +0000 (14:37 +0200)
Change-Id: If6a988359b4d2747cefdd683b6328f5b36e37548
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/jobs.c
src/jobs.h
src/main.c
src/sig-monitor.c

index 8725d00..1e84c82 100644 (file)
@@ -689,7 +689,7 @@ struct sd_event *jobs_get_sd_event()
  * @param start         The start routine to activate (can't be NULL)
  * @return 0 in case of success or -1 in case of error.
  */
-int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)())
+int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)(int signum))
 {
        int rc, launched;
        struct thread me;
index 49f45dd..f461342 100644 (file)
@@ -44,5 +44,5 @@ extern struct sd_event *jobs_get_sd_event();
 
 extern void jobs_terminate();
 
-extern int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)());
+extern int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)(int signum));
 
index fc1ec13..6b89aef 100644 (file)
@@ -529,10 +529,15 @@ static void run_startup_calls()
  | job for starting the daemon
  +--------------------------------------------------------- */
 
-static void start()
+static void start(int signum)
 {
        struct afb_hsrv *hsrv;
 
+       if (signum) {
+               ERROR("start aborted: received signal %s", strsignal(signum));
+               exit(1);
+       }
+
        // ------------------ sanity check ----------------------------------------
        if (config->httpdPort <= 0) {
                ERROR("no port is defined");
index ce0a4cd..aaffaed 100644 (file)
@@ -187,6 +187,3 @@ void sig_monitor(int timeout, void (*function)(int sig, void*), void *arg)
 }
 
 
-
-
-