diff options
author | mestre <mestre@cvs.openbsd.org> | 2016-03-16 15:00:36 +0000 |
---|---|---|
committer | mestre <mestre@cvs.openbsd.org> | 2016-03-16 15:00:36 +0000 |
commit | c7f397c233375064250a50d8cabea634e4e58188 (patch) | |
tree | edeb82894f0217297e1e3dfce5fc1d07abe43ec7 /games/hack/hack.rumors.c | |
parent | 3fe9e94ac26cafe0dd5c414844cd41fdb723339f (diff) |
Prefer fseek(3) over rewind(3) since the latter although it also calls fseek
then additionally it calls clearerr(3) deliberately but we want to catch any
error that may happen and this way we couldn't catch it
OK tb@
Diffstat (limited to 'games/hack/hack.rumors.c')
-rw-r--r-- | games/hack/hack.rumors.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/games/hack/hack.rumors.c b/games/hack/hack.rumors.c index 8713d71d58f..17141c6668b 100644 --- a/games/hack/hack.rumors.c +++ b/games/hack/hack.rumors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.rumors.c,v 1.9 2016/01/09 18:33:15 mestre Exp $ */ +/* $OpenBSD: hack.rumors.c,v 1.10 2016/03/16 15:00:35 mestre Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -61,6 +61,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <err.h> #include <stdio.h> #include "hack.h" /* for RUMORFILE and BSD (index) */ @@ -82,7 +83,8 @@ init_rumors(FILE *rumf) n_used_rumors = 0; while(skipline(rumf)) n_rumors++; - rewind(rumf); + if (fseek(rumf, 0L, SEEK_SET) == -1) + err(1, "fseek"); i = n_rumors/CHARSZ; usedbits = (char *) alloc((unsigned)(i+1)); for( ; i>=0; i--) usedbits[i] = 0; |