Close file on error. CID 176.

This commit is contained in:
cube 2006-03-19 22:34:44 +00:00
parent f68eabdfe8
commit 11820066f8

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.8 2005/12/10 13:39:47 cube Exp $ */ /* $NetBSD: main.c,v 1.9 2006/03/19 22:34:44 cube Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -1201,6 +1201,7 @@ int
mkident(void) mkident(void)
{ {
FILE *fp; FILE *fp;
int error = 0;
(void)unlink("ident"); (void)unlink("ident");
@ -1215,10 +1216,10 @@ mkident(void)
if (vflag) if (vflag)
(void)printf("using ident '%s'\n", ident); (void)printf("using ident '%s'\n", ident);
if (fprintf(fp, "%s\n", ident) < 0) if (fprintf(fp, "%s\n", ident) < 0)
return (1); error = 1;
(void)fclose(fp); (void)fclose(fp);
return (0); return error;
} }
void void