From e4ce2ac585258ceee567ad16e3310636d9b71cae Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 17 Mar 1998 23:28:59 +0000 Subject: do not ferror() after fclose(); dholland@eecs.harvard.edu --- lib/libc/gen/getcap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index 9e96e5e6870..98e7c14acef 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.11 1997/09/12 08:53:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getcap.c,v 1.12 1998/03/17 23:28:58 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -673,11 +673,12 @@ cgetnext(bp, db_array) } else { line = fgetln(pfp, &len); if (line == NULL && pfp) { - (void)fclose(pfp); if (ferror(pfp)) { + (void)fclose(pfp); (void)cgetclose(); return (-1); } else { + (void)fclose(pfp); if (*++dbp == NULL) { (void)cgetclose(); return (0); @@ -731,11 +732,12 @@ cgetnext(bp, db_array) } else { /* name field extends beyond the line */ line = fgetln(pfp, &len); if (line == NULL && pfp) { - (void)fclose(pfp); if (ferror(pfp)) { + (void)fclose(pfp); (void)cgetclose(); return (-1); } + (void)fclose(pfp); } else line[len - 1] = '\0'; } -- cgit v1.2.3