summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpvalchev <pvalchev@openbsd.org>2006-05-30 19:43:27 +0000
committerpvalchev <pvalchev@openbsd.org>2006-05-30 19:43:27 +0000
commit2407c683855120f1964dbec88e96aca061c74c2c (patch)
tree0acfa4467a919ab1329c7dd6aff9ee35e68eea73
parentthis fixes a crash observed by Naddy on amd64, and permits the src/dst ip's to (diff)
downloadwireguard-openbsd-2407c683855120f1964dbec88e96aca061c74c2c.tar.xz
wireguard-openbsd-2407c683855120f1964dbec88e96aca061c74c2c.zip
avoid double fclose(), from coverity/NetBSD; ok otto
-rw-r--r--usr.bin/vi/ex/ex_write.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/vi/ex/ex_write.c b/usr.bin/vi/ex/ex_write.c
index 7f9970f2783..9ab12e14306 100644
--- a/usr.bin/vi/ex/ex_write.c
+++ b/usr.bin/vi/ex/ex_write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_write.c,v 1.8 2006/03/11 06:52:00 ray Exp $ */
+/* $OpenBSD: ex_write.c,v 1.9 2006/05/30 19:43:27 pvalchev Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -355,14 +355,17 @@ ex_writefp(sp, name, fp, fm, tm, nlno, nch, silent)
S_ISREG(sb.st_mode) && fsync(fileno(fp)))
goto err;
- if (fclose(fp))
+ if (fclose(fp)) {
+ fp = NULL;
goto err;
+ }
rval = 0;
if (0) {
err: if (!F_ISSET(sp->ep, F_MULTILOCK))
msgq_str(sp, M_SYSERR, name, "%s");
- (void)fclose(fp);
+ if (fp != NULL)
+ (void)fclose(fp);
rval = 1;
}