Source-Changes-HG archive

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

[src/trunk]: src/games/hunt/huntd If you are going to use memcpy instead of s...



details:   https://anonhg.NetBSD.org/src/rev/bc878d6c80f8
branches:  trunk
changeset: 328164:bc878d6c80f8
user:      apb <apb%NetBSD.org@localhost>
date:      Fri Mar 28 17:49:11 2014 +0000

description:
If you are going to use memcpy instead of struct assignment, then at
least use sizeof(the correct variable).  The use of memcmp to test
two pointers for equality, one line earlier, is also weird but may be
correct.

diffstat:

 games/hunt/huntd/get_names.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 1f67228f6cac -r bc878d6c80f8 games/hunt/huntd/get_names.c
--- a/games/hunt/huntd/get_names.c      Fri Mar 28 15:35:55 2014 +0000
+++ b/games/hunt/huntd/get_names.c      Fri Mar 28 17:49:11 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: get_names.c,v 1.10 2009/07/04 04:29:55 dholland Exp $  */
+/*     $NetBSD: get_names.c,v 1.11 2014/03/28 17:49:11 apb 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.10 2009/07/04 04:29:55 dholland Exp $");
+__RCSID("$NetBSD: get_names.c,v 1.11 2014/03/28 17:49:11 apb Exp $");
 #endif /* not lint */
 
 #include "bsd.h"
@@ -146,7 +146,7 @@
        if (memcmp(&his_machine_name, &my_machine_name,
                                                sizeof(his_machine_name)) == 0)
                memcpy(&his_machine_addr, &my_machine_addr,
-                                               sizeof(his_machine_name));
+                                               sizeof(his_machine_addr));
        else {
                /* look up the address of the recipient's machine */
                hp = gethostbyname(his_machine_name);



Home | Main Index | Thread Index | Old Index