summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-01-24 19:38:45 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-01-24 19:38:45 +0000
commit22ae3e7e7b6e003e8e1d09f2225f01e72c3c4b14 (patch)
treee154491798f3aefa0c3a39c6bdcc8e79606f3706 /usr.bin
parent36fa48585764f801a658886e742f4769134c9850 (diff)
fclose file stream before opening a new one.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/bc/scan.l6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l
index c5e128f38d8..5c557bff79c 100644
--- a/usr.bin/bc/scan.l
+++ b/usr.bin/bc/scan.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: scan.l,v 1.19 2005/12/03 18:23:47 deraadt Exp $ */
+/* $OpenBSD: scan.l,v 1.20 2006/01/24 19:38:44 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -18,7 +18,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: scan.l,v 1.19 2005/12/03 18:23:47 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: scan.l,v 1.20 2006/01/24 19:38:44 otto Exp $";
#endif /* not lint */
#include <err.h>
@@ -265,6 +265,8 @@ yywrap(void)
free(cmdexpr);
state++;
}
+ if (yyin != NULL && yyin != stdin)
+ fclose(yyin);
if (fileindex < sargc) {
filename = sargv[fileindex++];
yyin = fopen(filename, "r");