Source-Changes-HG archive

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

[src/trunk]: src/games/hunt/hunt If we're searching for a huntd, probe local_...



details:   https://anonhg.NetBSD.org/src/rev/6ddca6560cd5
branches:  trunk
changeset: 536680:6ddca6560cd5
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Sep 20 17:27:57 2002 +0000

description:
If we're searching for a huntd, probe local_address along with broadcast
addresses.

diffstat:

 games/hunt/hunt/hunt.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (45 lines):

diff -r 2b0a076030bf -r 6ddca6560cd5 games/hunt/hunt/hunt.c
--- a/games/hunt/hunt/hunt.c    Fri Sep 20 15:47:19 2002 +0000
+++ b/games/hunt/hunt/hunt.c    Fri Sep 20 17:27:57 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hunt.c,v 1.13 2002/09/20 15:47:19 mycroft Exp $        */
+/*     $NetBSD: hunt.c,v 1.14 2002/09/20 17:27:57 mycroft Exp $        */
 /*
  *  Hunt
  *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@@ -7,7 +7,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.13 2002/09/20 15:47:19 mycroft Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.14 2002/09/20 17:27:57 mycroft Exp $");
 #endif /* not lint */
 
 # include      <sys/param.h>
@@ -452,12 +452,6 @@
        if (initial)
                brdc = broadcast_vec(test_socket, (struct sockaddr **) &brdv);
 
-       if (brdc <= 0) {
-               initial = FALSE;
-               test.sin_addr = local_address;
-               goto test_one_host;
-       }
-
 # ifdef SO_BROADCAST
        /* Sun's will broadcast even though this option can't be set */
        option = 1;
@@ -480,6 +474,13 @@
                        /* NOTREACHED */
                }
        }
+       test.sin_addr = local_address;
+       if (sendto(test_socket, (char *) &msg, sizeof msg, 0,
+           (struct sockaddr *) &test, DAEMON_SIZE) < 0) {
+               warn("sendto");
+               leave(1, "sendto");
+               /* NOTREACHED */
+       }
 # else /* !BROADCAST */
        /* loop thru all hosts on local net and send msg to them. */
        msg = htons(C_TESTMSG());



Home | Main Index | Thread Index | Old Index