Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 2009 20:12:02 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200806 - head/usr.sbin/newsyslog
Message-ID:  <200912212012.nBLKC2aS039479@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912212012.nBLKC2aS039479>