]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon: check if started through systemd first
authorVincent Bernat <vincent@bernat.ch>
Mon, 3 Dec 2018 08:33:18 +0000 (09:33 +0100)
committerVincent Bernat <vincent@bernat.ch>
Mon, 3 Dec 2018 08:33:18 +0000 (09:33 +0100)
When running with `-d`, we may still need to send a notification to
systemd, even if we didn't plan to daemonize.

Fix #309.

src/daemon/lldpd.c

index 3f5733b887fc93823e7aa6094a43b0bed2b2324b..1d92dd3cc5ffcffe3ed7a9c35438b21e9a37e60c 100644 (file)
@@ -1791,8 +1791,7 @@ lldpd_main(int argc, char *argv[], char *envp[])
 
        /* Daemonization, unless started by systemd or launchd or debug */
 #ifndef HOST_OS_OSX
-       if (daemonize &&
-           !lldpd_started_by_systemd()) {
+       if (!lldpd_started_by_systemd() && daemonize) {
                int pid;
                char *spid;
                log_debug("main", "going into background");