summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-03-17 23:28:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-03-17 23:28:59 +0000
commite4ce2ac585258ceee567ad16e3310636d9b71cae (patch)
tree7697bc1c31ee3b91a28a99756ae99e85daaa9e92 /lib
parentd25b8002e1b5fa76d5a64834354fbef795c8cff9 (diff)
do not ferror() after fclose(); dholland@eecs.harvard.edu
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getcap.c8
1 files changed, 5 insertions, 3 deletions
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 <sys/types.h>
@@ -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';
}