Page 1 of 1

lfd incorrectly attempts to close and unlink pid file in TESTING mode

Posted: 24 Jun 2018, 20:47
by tgage
Attempting to start LFD while in TESTING mode does not report the correct error "*Error* lfd will not run with TESTING enabled in /etc/csf/csf.conf". Instead, /usr/sbin/lfd attempts to close and unlink the $pidfile /var/run/lfd.pid using an undefined file handle $PIDFILE at line 7186. This causes the error: "Can't use an undefined value as a symbol reference at /usr/sbin/lfd line.7186".

Also referenced in thread: viewtopic.php?f=6&t=10867&p=29612#p29612

Re: lfd incorrectly attempts to close and unlink pid file in TESTING mode

Posted: 24 Jun 2018, 21:04
by tgage

Code: Select all

--- lfd	2018-06-24 20:02:30.524696331 +0000
+++ lfd.patched	2018-06-24 20:02:15.830848692 +0000
@@ -7183,8 +7183,11 @@
 	}
 	logfile("daemon stopped");

-	close($PIDFILE);
-	unlink $pidfile;
+	# If PIDFILE is not defined then LFD is not started (TESTING mode?)
+	if ( defined($PIDFILE) ) {
+	    close($PIDFILE);
+	    unlink $pidfile;
+	}

 	kill (9, -$$);