svn commit: r200806 - head/usr.sbin/newsyslog

Xin LI delphij at FreeBSD.org
Mon Dec 21 20:12:02 UTC 2009


Author: delphij
Date: Mon Dec 21 20:12:01 2009
New Revision: 200806
URL: http://svn.freebsd.org/changeset/base/200806

Log:
  Don't consider non-existence of a PID file an error, we should be able
  to proceed anyway as this most likely mean that the process has been
  terminated.
  
  PR:		bin/140397
  Submitted by:	Dan Lukes <dan obluda cz>
  MFC after:	1 month

Modified:
  head/usr.sbin/newsyslog/newsyslog.c

Modified: head/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.c	Mon Dec 21 20:09:19 2009	(r200805)
+++ head/usr.sbin/newsyslog/newsyslog.c	Mon Dec 21 20:12:01 2009	(r200806)
@@ -1779,7 +1779,18 @@ set_swpid(struct sigwork_entry *swork, c
 
 	f = fopen(ent->pid_file, "r");
 	if (f == NULL) {
-		warn("can't open pid file: %s", ent->pid_file);
+		if (errno == ENOENT) {
+			/*
+			 * Warn if the PID file doesn't exist, but do
+			 * not consider it an error.  Most likely it
+			 * means the process has been terminated,
+			 * so it should be safe to rotate any log
+			 * files that the process would have been using.
+			 */
+			swork->sw_pidok = 1;
+			warnx("pid file doesn't exist: %s", ent->pid_file);
+		} else
+			warn("can't open pid file: %s", ent->pid_file);
 		return;
 	}
 


More information about the svn-src-head mailing list