summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-11-22 19:12:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-11-22 19:12:58 +0000
commit4cde7c096592e4570bcfed48bacc9259ca830cd1 (patch)
tree4e7fac9f8079be889277f876305cf28b0d448733 /lib
parent6a1116eb9c8e87ab5e3b85557d32e63d593097b5 (diff)
avoid double fclose()
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getcap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index 2131dbda51d..6cb1ef49370 100644
--- a/lib/libc/gen/getcap.c
+++ b/lib/libc/gen/getcap.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getcap.c,v 1.16 1999/02/25 21:40:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: getcap.c,v 1.17 2000/11/22 19:12:57 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -694,11 +694,11 @@ cgetnext(bp, db_array)
line = fgetln(pfp, &len);
if (line == NULL && pfp) {
if (ferror(pfp)) {
- (void)fclose(pfp);
(void)cgetclose();
return (-1);
} else {
(void)fclose(pfp);
+ pfp = NULL;
if (*++dbp == NULL) {
(void)cgetclose();
return (0);
@@ -753,7 +753,6 @@ cgetnext(bp, db_array)
line = fgetln(pfp, &len);
if (line == NULL && pfp) {
if (ferror(pfp)) {
- (void)fclose(pfp);
(void)cgetclose();
return (-1);
}