avoid double fclose()

coverity 2577 / run 6
This commit is contained in:
rtr 2006-03-19 05:01:48 +00:00
parent dcd8e4c853
commit 880b6df674
1 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_write.c,v 1.11 2005/06/02 04:25:16 lukem Exp $ */
/* $NetBSD: ex_write.c,v 1.12 2006/03/19 05:01:48 rtr Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -16,7 +16,7 @@
#if 0
static const char sccsid[] = "@(#)ex_write.c 10.30 (Berkeley) 7/12/96";
#else
__RCSID("$NetBSD: ex_write.c,v 1.11 2005/06/02 04:25:16 lukem Exp $");
__RCSID("$NetBSD: ex_write.c,v 1.12 2006/03/19 05:01:48 rtr Exp $");
#endif
#endif /* not lint */
@ -360,14 +360,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 (NULL != fp)
(void)fclose(fp);
rval = 1;
}