summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Harnett <danh@cvs.openbsd.org>2004-12-21 23:09:33 +0000
committerDan Harnett <danh@cvs.openbsd.org>2004-12-21 23:09:33 +0000
commit5763b80e79dba4389cc643b8125c5f09143e15d1 (patch)
treeaf4ce0518be2cf218df8f656be0cdc73b49cb5cd
parenteb3b913525ba5ae617a4e14d90d0919ca7a4929c (diff)
silently ignore some cases when sendto(2) fails rather than disabling
logging to a remote host. Similar patch sent by Marc Huber <Marc.Huber@web.de> in PR4044. ok deraadt@ henning@ millert@
-rw-r--r--usr.sbin/syslogd/syslogd.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index d8f0638411c..5685fc09b63 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.86 2004/12/20 20:59:19 otto Exp $ */
+/* $OpenBSD: syslogd.c,v 1.87 2004/12/21 23:09:32 danh Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.86 2004/12/20 20:59:19 otto Exp $";
+static const char rcsid[] = "$OpenBSD: syslogd.c,v 1.87 2004/12/21 23:09:32 danh Exp $";
#endif
#endif /* not lint */
@@ -855,8 +855,18 @@ fprintlog(struct filed *f, int flags, char *msg)
if (sendto(pfd[PFD_INET].fd, line, l, 0,
(struct sockaddr *)&f->f_un.f_forw.f_addr,
f->f_un.f_forw.f_addr.ss_len) != l) {
- f->f_type = F_UNUSED;
- logerror("sendto");
+ switch (errno) {
+ case EHOSTDOWN:
+ case EHOSTUNREACH:
+ case ENETDOWN:
+ case ENOBUFS:
+ /* silently dropped */
+ break;
+ default:
+ f->f_type = F_UNUSED;
+ logerror("sendto");
+ break;
+ }
}
break;