From 3ff3f7bfc7d1b4d7d3bea7895fac861e24ea74ce Mon Sep 17 00:00:00 2001 From: Adam Yi Date: Mon, 6 Jul 2020 09:59:19 +0000 Subject: [PATCH 1/2] fix file descriptor leak in example http server code --- examples/http/minified_server.bf | 13 +++++++------ examples/http/server.bf | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/examples/http/minified_server.bf b/examples/http/minified_server.bf index bd69b03..2c8b99f 100644 --- a/examples/http/minified_server.bf +++ b/examples/http/minified_server.bf @@ -51,9 +51,10 @@ +><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<>>+>>>++>->-><<<<< -<<<<<<<<<<%[-]>[-]>[-]>[-]<<<+++>+>>+<<<%>>>>>>>>>>>>>>>>>>[>]>>[-]<<<[[-]<]<<<[-]<[-]<[ --]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<<<<<<<<<<<<<<<<<<<<<<<<<< -<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>> ->>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]+++>[-]>[-]+>[-]++>[-]> -[-]+>[-]+>[-]>[-]+>[-]>[-]+++>[-]>[-]+>>>>>>>>>>>>>>>>>>>>[-]>>[-]++++++++++++++++>[-]>[ --]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+] +<<<<<<<<<<%[-]>[-]>[-]>[-]<<<+++>+>>+<<<%>>>[-]>[-]>[-]>[-]<<<+++>+>>+<<<%<<<>>>>>>>>>>> +>>>>>>>[>]>>[-]<<<[[-]<]<<<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[ +-]<[-]<[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<< +<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<[-]>[-]+++>[-]>[-]+>[-]++>[-]>[-]+>[-]+>[-]>[-]+>[-]>[-]+++>[-]>[-]+>>>>>>>>>>>>>> +>>>>>>[-]>>[-]++++++++++++++++>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<+] diff --git a/examples/http/server.bf b/examples/http/server.bf index 7c5329d..f704aba 100644 --- a/examples/http/server.bf +++ b/examples/http/server.bf @@ -556,6 +556,35 @@ close() ======================================================================= Call close() % +close() ======================================================================= + + Move to cell 51 + >>> + + Close the opened file + + The current cell is 49 + The source file descriptor is in cell 53 + + Zero all cells 49 to 52 + [-]>[-]>[-]>[-]<<< + + +++ > close(): 3 + + > Arg count: 1 + + Arg 1: int fd + (0) > Arg type: 0 + + Arg len: 1 + (Arg value is already filled in) + <<< + + Call close() + % + + Move back to cell 48 + <<< + + Clean up and prepare to loop back to listen() ================================= >>>>>>>>>>>>>>>>>>[>]>>[-]<<<[[-]<] From 65da8289d4bd5c54d29ab52efca94da8b9f7e025 Mon Sep 17 00:00:00 2001 From: Adam Yi Date: Fri, 29 Aug 2025 22:54:45 +0800 Subject: [PATCH 2/2] Fix wrong cell counting in comment --- examples/http/server.bf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/http/server.bf b/examples/http/server.bf index f704aba..fdb5d2c 100644 --- a/examples/http/server.bf +++ b/examples/http/server.bf @@ -563,10 +563,10 @@ close() ======================================================================= Close the opened file - The current cell is 49 - The source file descriptor is in cell 53 + The current cell is 51 + The source file descriptor is in cell 55 - Zero all cells 49 to 52 + Zero all cells 51 to 54 [-]>[-]>[-]>[-]<<< +++ > close(): 3