[ar7] refresh and refine vlynq patch, patch from sn9
[openwrt.git] / package / busybox / patches / 610-syslog-remote-retry-connection.patch
index 5602e2b..94cd3de 100644 (file)
@@ -1,40 +1,39 @@
-Index: busybox-1.16.1/sysklogd/syslogd.c
-===================================================================
---- busybox-1.16.1.orig/sysklogd/syslogd.c     2010-03-28 13:44:04.000000000 -0400
-+++ busybox-1.16.1/sysklogd/syslogd.c  2010-06-17 21:48:11.000000000 -0400
-@@ -555,6 +555,7 @@
- static void do_syslogd(void)
+--- a/sysklogd/syslogd.c
++++ b/sysklogd/syslogd.c
+@@ -555,6 +555,7 @@ static void do_syslogd(void)
  {
        int sock_fd;
  {
        int sock_fd;
+ #if ENABLE_FEATURE_REMOTE_LOG
 +      int send_err = 0;
 +      int send_err = 0;
+       llist_t *item;
+ #endif
  #if ENABLE_FEATURE_SYSLOGD_DUP
  #if ENABLE_FEATURE_SYSLOGD_DUP
-       int last_sz = -1;
-       char *last_buf;
-@@ -632,10 +633,23 @@
-                        * over network, mimic that */
-                       recvbuf[sz] = '\n';
-                       /* send message to remote logger, ignore possible error */
+@@ -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? */
 -                      /* TODO: on some errors, close and set G.remoteFD to -1
 -                       * so that DNS resolution and connect is retried? */
--                      sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
--                                  &G.remoteAddr->u.sa, G.remoteAddr->len);
-+                      if ( sendto(G.remoteFD, recvbuf, sz+1, MSG_DONTWAIT,
-+                                  &G.remoteAddr->u.sa, G.remoteAddr->len)  == -1 ) {
+-                      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;
 +                              send_err = errno;
-+                  }
 +
 +                      /* On some errors, close and set G.remoteFD to -1
 +                       * so that DNS resolution and connect is retried */
 +
 +                      /* 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(G.remoteFD);
-+                                      G.remoteFD = -1;
++                      switch (send_err) {
++                              case ECONNRESET:
++                              case EDESTADDRREQ:
++                              case EISCONN:
++                              case ENOTCONN:
++                              case EPIPE:
++                                      close(rh->remoteFD);
++                                      rh->remoteFD = -1;
 +                                      break;
 +                                      break;
-+                  }
-  no_luck: ;
++                      }
                }
  #endif
                }
  #endif
+               if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
This page took 0.026499 seconds and 4 git commands to generate.