[svn:qpsmtpd] rev 493 - trunk

[email protected] 10 Jul 2005 11:46:16 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: aqua
Date: Sun Jul 10 04:46:15 2005
New Revision: 493

Modified:
   trunk/qpsmtpd-forkserver
Log:
If the PID file already exists at startup, truncate to zero-length before
attempting to re-use it.  Otherwise if the new PID is shorter than the
previous one the file will be corrupted by the rewrite (harmlessly the way it
is being read by this code, but problematically for anything that expects to
be able to run something similar to /bin/kill `cat /path/to/pid.file`)


Modified: trunk/qpsmtpd-forkserver
==============================================================================
--- trunk/qpsmtpd-forkserver	(original)
+++ trunk/qpsmtpd-forkserver	Sun Jul 10 04:46:15 2005
@@ -116,6 +116,8 @@ if ($PID_FILE) {
     }
     seek PID, 0, 0
       or die "Could not seek back to beginning of $PID_FILE: $!\n";
+    truncate PID, 0
+      or die "Could not truncate $PID_FILE at 0: $!";
   } else {
     open PID, ">$PID_FILE"
       or die "open pid_file: $!\n";