From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:12:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 406931065693; Mon, 21 Dec 2009 20:12:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F2A78FC0A; Mon, 21 Dec 2009 20:12:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKC29X039481; Mon, 21 Dec 2009 20:12:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKC2aS039479; Mon, 21 Dec 2009 20:12:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912212012.nBLKC2aS039479@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 20:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200806 - head/usr.sbin/newsyslog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:12:02 -0000 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 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; }