[LON-CAPA-cvs] cvs: loncom / loncron

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 10 Nov 2005 19:07:01 -0000


albertel		Thu Nov 10 14:07:01 2005 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - check that the value in the pid file is a number beforeing trying to kill it
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.61 loncom/loncron:1.62
--- loncom/loncron:1.61	Thu Oct  6 16:35:50 2005
+++ loncom/loncron	Thu Nov 10 14:07:01 2005
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.61 2005/10/06 20:35:50 albertel Exp $
+# $Id: loncron,v 1.62 2005/11/10 19:07:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -98,7 +98,7 @@
 	my $lfh=IO::File->new("$pidfile");
 	my $daemonpid=<$lfh>;
 	chomp($daemonpid);
-	if (kill 0 => $daemonpid) {
+	if ($daemonpid =~ /^\d+$/ && kill 0 => $daemonpid) {
 	    return 1;
 	} else {
 	    return 0;
@@ -134,7 +134,7 @@
 	my $lfh=IO::File->new("$pidfile");
 	$daemonpid=<$lfh>;
 	chomp($daemonpid);
-	if (kill 0 => $daemonpid) {
+	if ($daemonpid =~ /^\d+$/ && kill 0 => $daemonpid) {
 	    &log($fh,"<h3>$daemon at pid $daemonpid responding");
 	    if ($send) { &log($fh,", sending $send"); }
 	    &log($fh,"</h3>");