From 17f7469e20bb847b4102f4f3730b49504b3d5dbd Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 3 Dec 2018 09:33:18 +0100 Subject: [PATCH] daemon: check if started through systemd first 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 3f5733b8..1d92dd3c 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -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"); -- 2.39.5