summaryrefslogtreecommitdiff
path: root/mesh/main.c
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2018-11-22 11:37:32 -0800
committerBrian Gix <brian.gix@intel.com>2018-11-28 08:41:21 -0800
commitd800a11512753ac7d24555862963e23b1516148a (patch)
treefd181c63374803ae5ea5ebb41c5be5eea7cf1fb2 /mesh/main.c
parent5f3e2ea6bdb1396e6b31dfcd865719e981e5176e (diff)
downloadbluez-d800a11512753ac7d24555862963e23b1516148a.tar.gz
mesh: Up-rev ELL dependancies to >= 0.14
Diffstat (limited to 'mesh/main.c')
-rw-r--r--mesh/main.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/mesh/main.c b/mesh/main.c
index 289b0582b..97f506a75 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
+#include <signal.h>
#include <sys/stat.h>
#include <ell/ell.h>
@@ -59,29 +60,22 @@ static void usage(void)
"\t--help Show %s information\n", __func__);
}
-static void signal_handler(struct l_signal *signal, uint32_t signo,
- void *user_data)
+static void signal_handler(uint32_t signo, void *user_data)
{
static bool terminated;
- switch (signo) {
- case SIGINT:
- case SIGTERM:
- if (terminated)
- return;
- l_info("Terminating");
- l_main_quit();
- terminated = true;
- break;
- }
+ if (terminated)
+ return;
+
+ l_info("Terminating");
+ l_main_quit();
+ terminated = true;
}
int main(int argc, char *argv[])
{
int status;
bool detached = true;
- struct l_signal *signal;
- sigset_t mask;
struct bt_mesh *mesh = NULL;
const char *config_file = NULL;
int index = MGMT_INDEX_NONE;
@@ -140,11 +134,6 @@ int main(int argc, char *argv[])
goto done;
}
- sigemptyset(&mask);
- sigaddset(&mask, SIGINT);
- sigaddset(&mask, SIGTERM);
- signal = l_signal_create(&mask, signal_handler, NULL, NULL);
-
umask(0077);
if (detached) {
@@ -155,9 +144,7 @@ int main(int argc, char *argv[])
}
}
- status = l_main_run();
-
- l_signal_remove(signal);
+ status = l_main_run_with_signal(signal_handler, NULL);
done:
mesh_unref(mesh);