diff options
author | 2011-06-20 17:40:55 +0000 | |
---|---|---|
committer | 2011-06-20 17:40:55 +0000 | |
commit | c3fc728d99f8f3144007c7211b7e14327239f64d (patch) | |
tree | ea195f098f997fd1ee014c979748639a09a963d8 | |
parent | serialize attach and detach of device sub-trees -- only one device (diff) | |
download | wireguard-openbsd-c3fc728d99f8f3144007c7211b7e14327239f64d.tar.xz wireguard-openbsd-c3fc728d99f8f3144007c7211b7e14327239f64d.zip |
Do not compare a `char' variable to EOF, which does not fit if `char' defaults
to unsigned (e.g. arm, powerpc); ok guenther@ matthew@ looks good deraadt@
-rw-r--r-- | games/sail/sync.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/games/sail/sync.c b/games/sail/sync.c index 9bf85efac9e..73b8d69eef5 100644 --- a/games/sail/sync.c +++ b/games/sail/sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sync.c,v 1.9 2009/10/27 23:59:27 deraadt Exp $ */ +/* $OpenBSD: sync.c,v 1.10 2011/06/20 17:40:55 miod Exp $ */ /* $NetBSD: sync.c,v 1.9 1998/08/30 09:19:40 veego Exp $ */ /* @@ -253,16 +253,18 @@ Sync() if (isstr != 0 && isstr != 1) goto bad; if (isstr) { + int ch; char *p; + for (p = buf;;) { - switch (*p++ = getc(sync_fp)) { + ch = getc(sync_fp); + switch (ch) { case '\n': - p--; case EOF: break; default: - if (p >= buf + sizeof buf) - p--; + if (p < buf + sizeof buf) + *p++ = ch; continue; } break; |