summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2009-12-21 20:12:01 +0000
committerdelphij <delphij@FreeBSD.org>2009-12-21 20:12:01 +0000
commit5fbacdf9a7b061873353d677a41c07409b749c7e (patch)
tree54e47e22607d1e7b6b6f9b7a5c81cb529e3527f2 /usr.sbin/newsyslog
parent70c567a7537653168b0f86d33547b306938d324c (diff)
downloadFreeBSD-src-5fbacdf9a7b061873353d677a41c07409b749c7e.zip
FreeBSD-src-5fbacdf9a7b061873353d677a41c07409b749c7e.tar.gz
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
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index ef74f23..0878978 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -1779,7 +1779,18 @@ set_swpid(struct sigwork_entry *swork, const struct conf_entry *ent)
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;
}
OpenPOWER on IntegriCloud