summaryrefslogtreecommitdiffstats
path: root/hunt
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2014-03-29 19:01:00 +0000
committerdholland <dholland@NetBSD.org>2014-03-29 19:01:00 +0000
commit89b01be26907d5a1948344d5f04bb48dc0723da8 (patch)
treef2663a01748366369a4f45e24dd06bd487dbe49e /hunt
parenta2275b5fd1be0aa6ef4198218acf65eaf565a329 (diff)
downloadbsdgames-darwin-89b01be26907d5a1948344d5f04bb48dc0723da8.tar.gz
bsdgames-darwin-89b01be26907d5a1948344d5f04bb48dc0723da8.tar.zst
bsdgames-darwin-89b01be26907d5a1948344d5f04bb48dc0723da8.zip
simplify silly logic
Diffstat (limited to 'hunt')
-rw-r--r--hunt/huntd/get_names.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/hunt/huntd/get_names.c b/hunt/huntd/get_names.c
index 89601386..ad02d71a 100644
--- a/hunt/huntd/get_names.c
+++ b/hunt/huntd/get_names.c
@@ -1,4 +1,4 @@
-/* $NetBSD: get_names.c,v 1.11 2014/03/28 17:49:11 apb Exp $ */
+/* $NetBSD: get_names.c,v 1.12 2014/03/29 19:01:00 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get_names.c,v 1.11 2014/03/28 17:49:11 apb Exp $");
+__RCSID("$NetBSD: get_names.c,v 1.12 2014/03/29 19:01:00 dholland Exp $");
#endif /* not lint */
#include "bsd.h"
@@ -126,6 +126,7 @@ get_remote_name(char *his_address)
/* this is a local to local talk */
his_name = his_address;
his_machine_name = my_machine_name;
+ his_machine_addr = my_machine_addr;
} else {
if (*ptr == '@') {
/* user@host */
@@ -137,23 +138,19 @@ get_remote_name(char *his_address)
his_machine_name = his_address;
}
*ptr = '\0';
- }
- /* Load these useful values into the standard message header */
- (void) strncpy(msg.r_name, his_name, NAME_SIZE);
- msg.r_name[NAME_SIZE - 1] = '\0';
- /* if he is on the same machine, then simply copy */
- if (memcmp(&his_machine_name, &my_machine_name,
- sizeof(his_machine_name)) == 0)
- memcpy(&his_machine_addr, &my_machine_addr,
- sizeof(his_machine_addr));
- else {
/* look up the address of the recipient's machine */
hp = gethostbyname(his_machine_name);
- if (hp == (struct hostent *) 0)
- return 0; /* unknown host */
+ if (hp == NULL) {
+ /* unknown host */
+ return 0;
+ }
memcpy(&his_machine_addr, hp->h_addr, hp->h_length);
}
+ /* Load these useful values into the standard message header */
+ (void) strncpy(msg.r_name, his_name, NAME_SIZE);
+ msg.r_name[NAME_SIZE - 1] = '\0';
+
return 1;
}
#endif