Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net visit next addrinfo struct on socket failure.



details:   https://anonhg.NetBSD.org/src/rev/be0bd803ee69
branches:  trunk
changeset: 481430:be0bd803ee69
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jan 31 10:23:03 2000 +0000

description:
visit next addrinfo struct on socket failure.

this should fix the behavior of rcmd() on ipv4-only node, trying to
connect to dual stack node (AAAA and A record on DNS/hostname databaes)

diffstat:

 lib/libc/net/rcmd.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 103c3888e58a -r be0bd803ee69 lib/libc/net/rcmd.c
--- a/lib/libc/net/rcmd.c       Mon Jan 31 08:49:07 2000 +0000
+++ b/lib/libc/net/rcmd.c       Mon Jan 31 10:23:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcmd.c,v 1.37 2000/01/27 05:33:06 itojun Exp $ */
+/*     $NetBSD: rcmd.c,v 1.38 2000/01/31 10:23:03 itojun Exp $ */
 
 /*
  * Copyright (c) 1997 Matthew R. Green.
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rcmd.c     8.3 (Berkeley) 3/26/94";
 #else
-__RCSID("$NetBSD: rcmd.c,v 1.37 2000/01/27 05:33:06 itojun Exp $");
+__RCSID("$NetBSD: rcmd.c,v 1.38 2000/01/31 10:23:03 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -242,8 +242,13 @@
                                warnx("rcmd: socket: All ports in use");
                        else
                                warn("rcmd: socket");
-                       (void)sigprocmask(SIG_SETMASK, &omask, NULL);
-                       return (-1);
+                       if (r->ai_next) {
+                               r = r->ai_next;
+                               continue;
+                       } else {
+                               (void)sigprocmask(SIG_SETMASK, &omask, NULL);
+                               return (-1);
+                       }
                }
                fcntl(s, F_SETOWN, pid);
                if (connect(s, r->ai_addr, r->ai_addrlen) >= 0)



Home | Main Index | Thread Index | Old Index