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

2 posts Page 1 of 1
tgage
Junior Member
Posts: 6
Joined: 24 Jun 2018, 20:39


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
tgage
Junior Member
Posts: 6
Joined: 24 Jun 2018, 20:39


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, -$$);
2 posts Page 1 of 1