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

Eric Jacobs eric at theeric.com
Sat Nov 5 09:49:02 PST 2005


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) {





More information about the Submit mailing list