Notice errors writing out the PID file and abort
Tomas Doran [Tue, 17 Apr 2012 13:24:41 +0000 (14:24 +0100)]
ChangeLog
lib/FCGI/ProcManager.pm

index 745f7c3..032cc56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+    * Notice errors writing out the PID file and abort.
+
 0.24 2011-10-04 Tomas Doran  <bobtfish@bobtfish.net>
     * Further fix to pm_wait routine to find the correct PID and remove it
       (fixing logical error introduced in the last release), noted by Vadim
index f4b0980..c1c4023 100644 (file)
@@ -359,12 +359,13 @@ specified, it uses the value of the C<pid_fname> parameter.
 sub pm_write_pid_file {
   my ($this,$fname) = self_or_default(@_);
   $fname ||= $this->pid_fname() or return;
-  if (!open PIDFILE, ">$fname") {
+  my $PIDFILE
+  if (!open $PIDFILE, ">$fname") {
     $this->pm_warn("open: $fname: $!");
     return;
   }
-  print PIDFILE "$$\n";
-  close PIDFILE;
+  print $PIDFILE "$$\n" or die "Could not print PID: $!";
+  close $PIDFILE or die "Could not close PID file";
 }
 
 =head2 pm_remove_pid_file