Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/faithd handle ECONNABORTED at accept(2). correct e...



details:   https://anonhg.NetBSD.org/src/rev/45eb8c7b77d6
branches:  trunk
changeset: 526054:45eb8c7b77d6
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Apr 24 12:14:42 2002 +0000

description:
handle ECONNABORTED at accept(2).  correct error handling for connect(2)
sync w/ kame

diffstat:

 usr.sbin/faithd/faithd.c |  14 ++++++++------
 usr.sbin/faithd/faithd.h |   3 +--
 usr.sbin/faithd/ftp.c    |   8 ++++----
 usr.sbin/faithd/tcp.c    |   6 +++---
 4 files changed, 16 insertions(+), 15 deletions(-)

diffs (94 lines):

diff -r da1fab322c01 -r 45eb8c7b77d6 usr.sbin/faithd/faithd.c
--- a/usr.sbin/faithd/faithd.c  Wed Apr 24 09:46:15 2002 +0000
+++ b/usr.sbin/faithd/faithd.c  Wed Apr 24 12:14:42 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: faithd.c,v 1.23 2002/01/11 04:20:55 itojun Exp $       */
-/*     $KAME: faithd.c,v 1.40 2001/07/02 14:36:48 itojun Exp $ */
+/*     $NetBSD: faithd.c,v 1.24 2002/04/24 12:14:42 itojun Exp $       */
+/*     $KAME: faithd.c,v 1.47 2002/04/24 12:06:15 itojun Exp $ */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -431,7 +431,9 @@
                len = sizeof(srcaddr);
                s_src = accept(s_wld, (struct sockaddr *)&srcaddr,
                        &len);
-               if (s_src == -1) {
+               if (s_src < 0) {
+                       if (errno == ECONNABORTED)
+                               goto again;
                        exit_failure("socket: %s", strerror(errno));
                        /*NOTREACHED*/
                }
@@ -461,9 +463,9 @@
 {
        struct sockaddr_storage dstaddr6;
        struct sockaddr_storage dstaddr4;
-       char src[MAXHOSTNAMELEN];
-       char dst6[MAXHOSTNAMELEN];
-       char dst4[MAXHOSTNAMELEN];
+       char src[NI_MAXHOST];
+       char dst6[NI_MAXHOST];
+       char dst4[NI_MAXHOST];
        int len = sizeof(dstaddr6);
        int s_dst, error, hport, nresvport, on = 1;
        struct timeval tv;
diff -r da1fab322c01 -r 45eb8c7b77d6 usr.sbin/faithd/faithd.h
--- a/usr.sbin/faithd/faithd.h  Wed Apr 24 09:46:15 2002 +0000
+++ b/usr.sbin/faithd/faithd.h  Wed Apr 24 12:14:42 2002 +0000
@@ -1,5 +1,4 @@
-/*     $NetBSD: faithd.h,v 1.7 2001/09/05 01:22:24 itojun Exp $        */
-/*     $KAME: faithd.h,v 1.7 2001/07/02 14:36:48 itojun Exp $  */
+/*     $KAME: faithd.h,v 1.8 2001/09/05 03:04:21 itojun Exp $  */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
diff -r da1fab322c01 -r 45eb8c7b77d6 usr.sbin/faithd/ftp.c
--- a/usr.sbin/faithd/ftp.c     Wed Apr 24 09:46:15 2002 +0000
+++ b/usr.sbin/faithd/ftp.c     Wed Apr 24 12:14:42 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ftp.c,v 1.7 2001/09/05 01:22:24 itojun Exp $   */
-/*     $KAME: ftp.c,v 1.13 2001/09/05 01:10:30 itojun Exp $    */
+/*     $NetBSD: ftp.c,v 1.8 2002/04/24 12:14:42 itojun Exp $   */
+/*     $KAME: ftp.c,v 1.14 2002/04/24 08:17:23 itojun Exp $    */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -258,7 +258,7 @@
                return -1;
        }
        error = connect(port6, sa, sa->sa_len);
-       if (port6 == -1) {
+       if (error < 0) {
                close(port6);
                close(port4);
                close(wport4);
@@ -305,7 +305,7 @@
                return -1;
        }
        error = connect(port4, sa, sa->sa_len);
-       if (port4 == -1) {
+       if (error < 0) {
                close(wport6);
                close(port4);
                close(port6);
diff -r da1fab322c01 -r 45eb8c7b77d6 usr.sbin/faithd/tcp.c
--- a/usr.sbin/faithd/tcp.c     Wed Apr 24 09:46:15 2002 +0000
+++ b/usr.sbin/faithd/tcp.c     Wed Apr 24 12:14:42 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: tcp.c,v 1.6 2001/11/21 06:52:35 itojun Exp $   */
-/*     $KAME: tcp.c,v 1.6 2001/07/02 14:36:49 itojun Exp $     */
+/*     $NetBSD: tcp.c,v 1.7 2002/04/24 12:14:42 itojun Exp $   */
+/*     $KAME: tcp.c,v 1.8 2001/11/21 07:40:22 itojun Exp $     */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -59,7 +59,7 @@
 static char atmark_buf[2];
 static pid_t cpid = (pid_t)0;
 static pid_t ppid = (pid_t)0;
-static time_t child_lastactive = (time_t)0;
+volatile time_t child_lastactive = (time_t)0;
 static time_t parent_lastactive = (time_t)0;
 
 static void sig_ctimeout __P((int));



Home | Main Index | Thread Index | Old Index