Letting systemd daemonize connmand, as we are already doing, there's no
need to have an option "-n" since it will work for both debugging and
running it as a daemon. Therefore, just remove the option.

Other init systems may use whatever method they have to turn connmand into a
daemon.
---
 src/connman.h          |  3 +--
 src/connman.service.in |  2 +-
 src/log.c              |  3 +--
 src/main.c             | 13 +------------
 unit/test-nat.c        |  2 +-
 5 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/connman.h b/src/connman.h
index 6726078..3738b26 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -111,8 +111,7 @@ int __connman_agent_report_error(struct connman_service 
*service,
 
 #include <connman/log.h>
 
-int __connman_log_init(const char *program, const char *debug,
-                                               connman_bool_t detach);
+int __connman_log_init(const char *program, const char *debug);
 void __connman_log_cleanup(void);
 void __connman_log_enable(struct connman_debug_desc *start,
                                        struct connman_debug_desc *stop);
diff --git a/src/connman.service.in b/src/connman.service.in
index fb690d8..dcc2350 100644
--- a/src/connman.service.in
+++ b/src/connman.service.in
@@ -4,7 +4,7 @@ Description=Connection service
 [Service]
 Type=dbus
 BusName=net.connman
-ExecStart=@prefix@/sbin/connmand -n
+ExecStart=@prefix@/sbin/connmand
 
 [Install]
 WantedBy=multi-user.target
diff --git a/src/log.c b/src/log.c
index 7c870be..96d9505 100644
--- a/src/log.c
+++ b/src/log.c
@@ -236,8 +236,7 @@ void __connman_log_enable(struct connman_debug_desc *start,
        }
 }
 
-int __connman_log_init(const char *program, const char *debug,
-                                               connman_bool_t detach)
+int __connman_log_init(const char *program, const char *debug)
 {
        static char path[PATH_MAX];
 
diff --git a/src/main.c b/src/main.c
index 5c206e7..202e266 100644
--- a/src/main.c
+++ b/src/main.c
@@ -328,7 +328,6 @@ static gchar *option_plugin = NULL;
 static gchar *option_nodevice = NULL;
 static gchar *option_noplugin = NULL;
 static gchar *option_wifi = NULL;
-static gboolean option_detach = TRUE;
 static gboolean option_dnsproxy = TRUE;
 static gboolean option_compat = FALSE;
 static gboolean option_version = FALSE;
@@ -358,9 +357,6 @@ static GOptionEntry options[] = {
                                "Specify plugins not to load", "NAME,..." },
        { "wifi", 'W', 0, G_OPTION_ARG_STRING, &option_wifi,
                                "Specify driver for WiFi/Supplicant", "NAME" },
-       { "nodaemon", 'n', G_OPTION_FLAG_REVERSE,
-                               G_OPTION_ARG_NONE, &option_detach,
-                               "Don't fork daemon to background" },
        { "nodnsproxy", 'r', G_OPTION_FLAG_REVERSE,
                                G_OPTION_ARG_NONE, &option_dnsproxy,
                                "Don't enable DNS Proxy" },
@@ -457,13 +453,6 @@ int main(int argc, char *argv[])
                exit(0);
        }
 
-       if (option_detach == TRUE) {
-               if (daemon(0, 0)) {
-                       perror("Can't start daemon");
-                       exit(1);
-               }
-       }
-
        if (mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
                                S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
                if (errno != EEXIST)
@@ -503,7 +492,7 @@ int main(int argc, char *argv[])
 
        g_dbus_set_disconnect_function(conn, disconnect_callback, NULL, NULL);
 
-       __connman_log_init(argv[0], option_debug, option_detach);
+       __connman_log_init(argv[0], option_debug);
 
        __connman_dbus_init(conn);
 
diff --git a/unit/test-nat.c b/unit/test-nat.c
index 578ff3e..7245b68 100644
--- a/unit/test-nat.c
+++ b/unit/test-nat.c
@@ -147,7 +147,7 @@ int main(int argc, char *argv[])
 
        g_test_init(&argc, &argv, NULL);
 
-       __connman_log_init(argv[0], "*", FALSE);
+       __connman_log_init(argv[0], "*");
        __connman_iptables_init();
        __connman_nat_init();
 
-- 
1.7.11.1

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to