diff options
author | dteske <dteske@FreeBSD.org> | 2016-01-07 02:06:14 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2016-01-07 02:06:14 +0000 |
commit | 846612d330bcaf313d14c10d56ac864aa14ab840 (patch) | |
tree | 22523887511fe23f0c2ae267f09d8658012511f6 | |
parent | e80b4985ee36108fe5b4503bca02541c3faa000b (diff) | |
download | FreeBSD-src-846612d330bcaf313d14c10d56ac864aa14ab840.zip FreeBSD-src-846612d330bcaf313d14c10d56ac864aa14ab840.tar.gz |
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
-rw-r--r-- | sys/boot/forth/support.4th | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/boot/forth/support.4th b/sys/boot/forth/support.4th index 7da92bc..6db232b 100644 --- a/sys/boot/forth/support.4th +++ b/sys/boot/forth/support.4th @@ -684,7 +684,7 @@ only forth also support-functions also file-processing definitions 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 definitions >search ( wid -- ) 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 definitions >search ( wid -- ) ['] 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 definitions \ 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 print the file name \ 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 print the file name 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 print the file name ; : 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 ; |