1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-26 14:22:03 +02:00
openwrt-xburst/package/busybox/patches/610-syslog-remote-retry-connection.patch
nico 5287284880 package/busybox: add missing bits from 1.17.1 update (mostly config stuff), rename upstream patches so they're applied first
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22665 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-08-15 20:28:05 +00:00

40 lines
1.2 KiB
Diff

--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -555,6 +555,7 @@ static void do_syslogd(void)
{
int sock_fd;
#if ENABLE_FEATURE_REMOTE_LOG
+ int send_err = 0;
llist_t *item;
#endif
#if ENABLE_FEATURE_SYSLOGD_DUP
@@ -636,11 +637,23 @@ static void do_syslogd(void)
if (rh->remoteFD == -1)
continue;
}
- /* Send message to remote logger, ignore possible error */
- /* TODO: on some errors, close and set G.remoteFD to -1
- * so that DNS resolution and connect is retried? */
- sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
- &(rh->remoteAddr->u.sa), rh->remoteAddr->len);
+ /* Send message to remote logger */
+ if (sendto(rh->remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
+ &(rh->remoteAddr->u.sa), rh->remoteAddr->len) == -1)
+ send_err = errno;
+
+ /* On some errors, close and set G.remoteFD to -1
+ * so that DNS resolution and connect is retried */
+ switch (send_err) {
+ case ECONNRESET:
+ case EDESTADDRREQ:
+ case EISCONN:
+ case ENOTCONN:
+ case EPIPE:
+ close(rh->remoteFD);
+ rh->remoteFD = -1;
+ break;
+ }
}
#endif
if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {