DragonFly BSD
DragonFly submit List (threaded) for 2005-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

usr.bin/make - double fclose on top-level file


From: Eric Jacobs <eric@xxxxxxxxxxx>
Date: Sat, 5 Nov 2005 11:45:48 -0600

This one came up when I was trying to get some cross-compiling going.

-Eric


*** usr.bin/make/parse.c.orig	Sat Nov  5 11:33:04 2005
--- usr.bin/make/parse.c	Sat Nov  5 11:38:44 2005
***************
*** 359,367 ****
   *	CONTINUE if there's more to do. DONE if not.
   *
   * Side Effects:
!  *	The old curFile.F is closed. The includes list is shortened.
!  *	curFile.lineno, curFile.F, and curFile.fname are changed if
!  *	CONTINUE is returned.
   */
  static int
  ParsePopInput(void)
--- 359,367 ----
   *	CONTINUE if there's more to do. DONE if not.
   *
   * Side Effects:
!  *	The old curFile.F is closed, but only if it was not a top-level
!  *	file. The includes list is shortened. curFile.lineno, curFile.F,
!  *	and curFile.fname are changed if CONTINUE is returned.
   */
  static int
  ParsePopInput(void)
***************
*** 375,381 ****
  
  	free(ifile->fname);
  	if (ifile->F != NULL) {
! 		fclose(ifile->F);
  		Var_Append(".MAKEFILE_LIST", "..", VAR_GLOBAL);
  	}
  	if (ifile->str != NULL) {
--- 375,383 ----
  
  	free(ifile->fname);
  	if (ifile->F != NULL) {
! 		/* Don't close the top-level file */
! 		if (!TAILQ_EMPTY(&includes))
! 			fclose(ifile->F);
  		Var_Append(".MAKEFILE_LIST", "..", VAR_GLOBAL);
  	}
  	if (ifile->str != NULL) {



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]