handle ECONNABORTED at accept(2). correct error handling for connect(2)

sync w/ kame
This commit is contained in:
itojun 2002-04-24 12:14:42 +00:00
parent a5a0fd620b
commit 3f18342704
4 changed files with 16 additions and 15 deletions

View File

@ -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 @@ again:
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 @@ play_child(int s_src, struct sockaddr *srcaddr)
{
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;

View File

@ -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.

View File

@ -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 @@ ftp_activeconn()
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 @@ ftp_passiveconn()
return -1;
}
error = connect(port4, sa, sa->sa_len);
if (port4 == -1) {
if (error < 0) {
close(wport6);
close(port4);
close(port6);

View File

@ -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 fd_set readfds, writefds, exceptfds;
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));