Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2016 02:06:14 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293296 - stable/10/sys/boot/forth
Message-ID:  <201601070206.u0726EqC092517@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Thu Jan  7 02:06:14 2016
New Revision: 293296
URL: https://svnweb.freebsd.org/changeset/base/293296

Log:
  MFC SVN revisions 292899,292996,292999-293000.
  
  r292899: Fix stack leak introduced by SVN r97201
  r292996: Remove debugging messages added by SVN r187143
  r292999: Fix a memory leak
  r293000: Remove supposition comment

Modified:
  stable/10/sys/boot/forth/support.4th
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/forth/support.4th
==============================================================================
--- stable/10/sys/boot/forth/support.4th	Thu Jan  7 02:04:17 2016	(r293295)
+++ stable/10/sys/boot/forth/support.4th	Thu Jan  7 02:06:14 2016	(r293296)
@@ -684,7 +684,7 @@ only forth also support-functions also f
   s" loader_conf_files" getenv conf_files string=
 ;
 
-: set_nextboot_conf \ XXX maybe do as set_conf_files ?
+: set_nextboot_conf
   value_buffer strget unquote nextboot_conf_file string=
 ;
 
@@ -833,7 +833,7 @@ get-current ( -- wid ) previous definiti
   repeat
 ;
 
-: peek_file
+: peek_file ( addr len -- )
   0 to end_of_file?
   reset_line_reading
   O_RDONLY fopen fd !
@@ -844,6 +844,7 @@ get-current ( -- wid ) previous definiti
   ['] process_assignment catch
   ['] free_buffers catch
   fd @ fclose
+  swap throw throw
 ;
   
 only forth also support-functions definitions
@@ -851,7 +852,6 @@ only forth also support-functions defini
 \ Interface to loading conf files
 
 : load_conf  ( addr len -- )
-  \ ." ----- Trying conf " 2dup type cr \ debugging
   0 to end_of_file?
   reset_line_reading
   O_RDONLY fopen fd !
@@ -943,7 +943,6 @@ string current_file_name_ref	\ used to p
 \ loader_conf_files processing support functions
 
 : get_conf_files ( -- addr len )  \ put addr/len on stack, reset var
-  \ ." -- starting on <" conf_files strtype ." >" cr \ debugging
   conf_files strget 0 0 conf_files strset
 ;
 
@@ -970,7 +969,6 @@ string current_file_name_ref	\ used to p
     pos char+ to pos
   repeat
   addr len pos addr r@ + pos r> -
-  \ 2dup ." get_file_name has " type cr \ debugging
 ;
 
 : get_next_file  ( addr len ptr -- addr len ptr' addr' len' | 0 )
@@ -1021,25 +1019,26 @@ string current_file_name_ref	\ used to p
 ;
 
 : get_nextboot_conf_file ( -- addr len )
-  nextboot_conf_file strget strdup	\ XXX is the strdup a leak ?
+  nextboot_conf_file strget
 ;
 
 : rewrite_nextboot_file ( -- )
   get_nextboot_conf_file
   O_WRONLY fopen fd !
   fd @ -1 = if EOPEN throw then
-  fd @ s' nextboot_enable="NO" ' fwrite
+  fd @ s' nextboot_enable="NO" ' fwrite ( fd buf len -- nwritten ) drop
   fd @ fclose
 ;
 
-: include_nextboot_file
+: include_nextboot_file ( -- )
   get_nextboot_conf_file
-  ['] peek_file catch
+  ['] peek_file catch if 2drop then
   nextboot? if
     get_nextboot_conf_file
+    current_file_name_ref strref
     ['] load_conf catch
     process_conf_errors
-    ['] rewrite_nextboot_file catch
+    ['] rewrite_nextboot_file catch if 2drop then
   then
 ;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601070206.u0726EqC092517>