summaryrefslogtreecommitdiff
path: root/mesh/main.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2019-06-03 23:07:48 -0700
committerBrian Gix <brian.gix@intel.com>2019-06-06 11:58:31 -0700
commit0f8cf75f6275dcbcdeaf6b1de420d27665f6b8cf (patch)
tree4884c95ac17438273c46c158723b615419315a62 /mesh/main.c
parent5bcce2ce592fa53b99cefdc37adabc21725525a8 (diff)
downloadbluez-0f8cf75f6275dcbcdeaf6b1de420d27665f6b8cf.tar.gz
mesh: Do not daemonize, run in foreground or as service
This removes call to daemon(). "--nodetach" option is retained to set umask(). Also, adds description for dbus-debug option.
Diffstat (limited to 'mesh/main.c')
-rw-r--r--mesh/main.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/mesh/main.c b/mesh/main.c
index a621300e6..3cecd8fbf 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -2,7 +2,7 @@
*
* BlueZ - Bluetooth protocol stack for Linux
*
- * Copyright (C) 2017-2018 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
@@ -41,6 +41,7 @@ static const struct option main_options[] = {
{ "config", optional_argument, NULL, 'c' },
{ "nodetach", no_argument, NULL, 'n' },
{ "debug", no_argument, NULL, 'd' },
+ { "dbus-debug", no_argument, NULL, 'b' },
{ "help", no_argument, NULL, 'h' },
{ }
};
@@ -49,12 +50,13 @@ static void usage(void)
{
l_info("");
l_info("Usage:\n"
- "\tmeshd [options]\n");
+ "\tbluetooth-meshd [options]\n");
l_info("Options:\n"
"\t--index <hcinum> Use specified controller\n"
"\t--config Configuration directory\n"
"\t--nodetach Run in foreground\n"
"\t--debug Enable debug output\n"
+ "\t--dbus-debug Enable D-Bus debugging\n"
"\t--help Show %s information\n", __func__);
}
@@ -170,7 +172,8 @@ int main(int argc, char *argv[])
goto done;
}
- umask(0077);
+ if (!detached)
+ umask(0077);
dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
if (!dbus) {
@@ -190,14 +193,6 @@ int main(int argc, char *argv[])
goto done;
}
- if (detached) {
- if (daemon(0, 0)) {
- perror("Failed to start meshd daemon");
- status = EXIT_FAILURE;
- goto done;
- }
- }
-
status = l_main_run_with_signal(signal_handler, NULL);
done: