summaryrefslogtreecommitdiffstats
path: root/boggle
diff options
context:
space:
mode:
authorrtr <rtr@NetBSD.org>2006-03-18 09:40:46 +0000
committerrtr <rtr@NetBSD.org>2006-03-18 09:40:46 +0000
commit0d7870ca669aae32c1290d20e6308f39bffc942c (patch)
tree58d1f48a1b10931e05e7f44c0cb7844cc85f46d4 /boggle
parenta26dfb5accabe938438abf0791f2a48ebbf478dc (diff)
downloadbsdgames-darwin-0d7870ca669aae32c1290d20e6308f39bffc942c.tar.gz
bsdgames-darwin-0d7870ca669aae32c1290d20e6308f39bffc942c.tar.zst
bsdgames-darwin-0d7870ca669aae32c1290d20e6308f39bffc942c.zip
fclose() open FILE * even though we are returning to fail anyway.
silences coverity, CID 1590 / run 5
Diffstat (limited to 'boggle')
-rw-r--r--boggle/boggle/word.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/boggle/boggle/word.c b/boggle/boggle/word.c
index b6f14d7f..abcc4796 100644
--- a/boggle/boggle/word.c
+++ b/boggle/boggle/word.c
@@ -1,4 +1,4 @@
-/* $NetBSD: word.c,v 1.8 2005/07/01 16:38:24 jmc Exp $ */
+/* $NetBSD: word.c,v 1.9 2006/03/18 09:40:46 rtr Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)word.c 8.1 (Berkeley) 6/11/93";
#else
-__RCSID("$NetBSD: word.c,v 1.8 2005/07/01 16:38:24 jmc Exp $");
+__RCSID("$NetBSD: word.c,v 1.9 2006/03/18 09:40:46 rtr Exp $");
#endif
#endif /* not lint */
@@ -193,21 +193,23 @@ loadindex(const char *indexfile)
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (strchr(buf, '\n') == NULL) {
warnx("A line in the index file is too long");
+ (void) fclose(fp);
return(-1);
}
j = *buf - 'a';
if (i != j) {
warnx("Bad index order");
+ (void) fclose(fp);
return(-1);
}
dictindex[j].start = atol(buf + 1);
dictindex[j].length = atol(buf + 9) - dictindex[j].start;
i++;
}
+ (void) fclose(fp);
if (i != 26) {
warnx("Bad index length");
return(-1);
}
- (void) fclose(fp);
return(0);
}