Always unlink the temporary file created by mkstemp(3).

This commit is contained in:
enami 1999-08-16 02:49:20 +00:00
parent a01d72e890
commit f6e5e6544e
1 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.22 1999/06/23 19:09:35 tv Exp $ */ /* $NetBSD: main.c,v 1.23 1999/08/16 02:49:20 enami Exp $ */
/*- /*-
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#else #else
__RCSID("$NetBSD: main.c,v 1.22 1999/06/23 19:09:35 tv Exp $"); __RCSID("$NetBSD: main.c,v 1.23 1999/08/16 02:49:20 enami Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -243,16 +243,17 @@ main(argc,argv)
for (n = 1; n < MAXOUT; n++) /* default wrap-up: undivert */ for (n = 1; n < MAXOUT; n++) /* default wrap-up: undivert */
if (outfile[n] != NULL) if (outfile[n] != NULL)
getdiv(n); getdiv(n);
/* remove bitbucket if used */ /* close bitbucket if used */
if (outfile[0] != NULL) { if (outfile[0] != NULL)
(void) fclose(outfile[0]); (void) fclose(outfile[0]);
m4temp[UNIQUE] = '0';
/* always remove bitbucket since mkstemp(3) creates it */
m4temp[UNIQUE] = '0';
#ifdef vms #ifdef vms
(void) remove(m4temp); (void) remove(m4temp);
#else #else
(void) unlink(m4temp); (void) unlink(m4temp);
#endif #endif
}
return 0; return 0;
} }