summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2001-05-07 22:57:20 +0000
committerMarc Espie <espie@cvs.openbsd.org>2001-05-07 22:57:20 +0000
commita0089b89afbf4eddef99fca0cd4dcc56f8690c60 (patch)
treeab4e8e6ec3eb81c1394f49f6577a50e80a397950 /usr.bin
parentd0df2cc1acd0dbb22d24b2e97433dd26c1b65ec7 (diff)
avoid closing the same file twice. parse module assumes ownership of
file handles it's passed to. (this is apparently harmless on BSDs, but is still a bug).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/lowparse.c4
-rw-r--r--usr.bin/make/main.c5
2 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c
index 7e74ce66b48..19f527cc656 100644
--- a/usr.bin/make/lowparse.c
+++ b/usr.bin/make/lowparse.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: lowparse.c,v 1.6 2001/05/03 13:41:07 espie Exp $ */
+/* $OpenBSD: lowparse.c,v 1.7 2001/05/07 22:57:19 espie Exp $ */
/* low-level parsing functions. */
@@ -147,7 +147,7 @@ static void
free_ifile(ifile)
IFile *ifile;
{
- if (ifile->F)
+ if (ifile->F && fileno(ifile->F) != STDIN_FILENO)
(void)fclose(ifile->F);
else
free(ifile->str);
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index b97e15e0476..757cfbc4932 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: main.c,v 1.46 2001/05/03 13:41:07 espie Exp $ */
+/* $OpenBSD: main.c,v 1.47 2001/05/07 22:57:19 espie Exp $ */
/* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */
/*
@@ -107,7 +107,7 @@ static char copyright[] =
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: main.c,v 1.46 2001/05/03 13:41:07 espie Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.47 2001/05/07 22:57:19 espie Exp $";
#endif
#endif /* not lint */
@@ -914,7 +914,6 @@ ReadMakefile(p, q)
*/
found: Var_Set("MAKEFILE", fname, VAR_GLOBAL);
Parse_File(fname, stream);
- (void)fclose(stream);
}
return TRUE;
}