summaryrefslogtreecommitdiffstats
path: root/hunt/hunt/playit.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2014-03-30 05:30:28 +0000
committerdholland <dholland@NetBSD.org>2014-03-30 05:30:28 +0000
commit4ddaf6127ab2fdcf268b76c9a33cb08bc276bfbf (patch)
treec5e563bc63ca82d2116ea9fce3f896dae11ad51f /hunt/hunt/playit.c
parentf0f60ae760a0274a50d65666e97a141a29287a8f (diff)
downloadbsdgames-darwin-4ddaf6127ab2fdcf268b76c9a33cb08bc276bfbf.tar.gz
bsdgames-darwin-4ddaf6127ab2fdcf268b76c9a33cb08bc276bfbf.tar.zst
bsdgames-darwin-4ddaf6127ab2fdcf268b76c9a33cb08bc276bfbf.zip
Remove SHORTLEN and LONGLEN defines; use sizeof() properly instead.
Fix two semi-compensating size bugs in wire transmission affecting 64-bit machines.
Diffstat (limited to 'hunt/hunt/playit.c')
-rw-r--r--hunt/hunt/playit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c
index 16978bfa..63da5658 100644
--- a/hunt/hunt/playit.c
+++ b/hunt/hunt/playit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: playit.c,v 1.20 2014/03/30 05:14:47 dholland Exp $ */
+/* $NetBSD: playit.c,v 1.21 2014/03/30 05:30:28 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: playit.c,v 1.20 2014/03/30 05:14:47 dholland Exp $");
+__RCSID("$NetBSD: playit.c,v 1.21 2014/03/30 05:30:28 dholland Exp $");
#endif /* not lint */
#include <sys/file.h>
@@ -93,8 +93,10 @@ playit(void)
int ch;
int y, x;
uint32_t version;
+ ssize_t result;
- if (read(huntsocket, &version, LONGLEN) != LONGLEN) {
+ result = read(huntsocket, &version, sizeof(version));
+ if (result != (ssize_t)sizeof(version)) {
bad_con();
/* NOTREACHED */
}
@@ -435,8 +437,10 @@ void
do_message(void)
{
uint32_t version;
+ ssize_t result;
- if (read(huntsocket, &version, LONGLEN) != LONGLEN) {
+ result = read(huntsocket, &version, sizeof(version));
+ if (result != (ssize_t)sizeof(version)) {
bad_con();
/* NOTREACHED */
}