summaryrefslogtreecommitdiff
path: root/usr.bin/man/man.c
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2006-12-14 19:25:59 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2006-12-14 19:25:59 +0000
commitbb9e05f2f16c566594528b2be3401f0f1dfb65df (patch)
treeb9e5d6968aca82ffeeb4bebcef01c59a43c6d18a /usr.bin/man/man.c
parent96cb813960fb5225665c9cd823b39c6d371c55bf (diff)
Coverity CID 2996: Don't return without closing fp.
Fix from christos NetBSD. ok otto@, millert@ (earlier version)
Diffstat (limited to 'usr.bin/man/man.c')
-rw-r--r--usr.bin/man/man.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
index 4b496479cf6..19913b47107 100644
--- a/usr.bin/man/man.c
+++ b/usr.bin/man/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.31 2005/11/12 00:51:13 deraadt Exp $ */
+/* $OpenBSD: man.c,v 1.32 2006/12/14 19:25:58 jasper Exp $ */
/* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-static char rcsid[] = "$OpenBSD: man.c,v 1.31 2005/11/12 00:51:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: man.c,v 1.32 2006/12/14 19:25:58 jasper Exp $";
#endif
#endif /* not lint */
@@ -624,8 +624,10 @@ how(char *fname)
print = 1;
continue;
} else if (!strncmp(buf, D1, sizeof(D1) - 1) ||
- !strncmp(buf, D2, sizeof(D2) - 1))
+ !strncmp(buf, D2, sizeof(D2) - 1)) {
+ (void)fclose(fp);
return;
+ }
if (!print)
continue;
if (*buf == '\n')