Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix file descriptor leak in example http server code #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions examples/http/minified_server.bf
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
+><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>+>>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<>>+>>>++>->-><<<<<
<<<<<<<<<<%[-]>[-]>[-]>[-]<<<+++>+>>+<<<%>>>>>>>>>>>>>>>>>>[>]>>[-]<<<[[-]<]<<<[-]<[-]<[
-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]+++>[-]>[-]+>[-]++>[-]>
[-]+>[-]+>[-]>[-]+>[-]>[-]+++>[-]>[-]+>>>>>>>>>>>>>>>>>>>>[-]>>[-]++++++++++++++++>[-]>[
-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+]
<<<<<<<<<<%[-]>[-]>[-]>[-]<<<+++>+>>+<<<%>>>[-]>[-]>[-]>[-]<<<+++>+>>+<<<%<<<>>>>>>>>>>>
>>>>>>>[>]>>[-]<<<[[-]<]<<<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[
-]<[-]<[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<[-]>[-]+++>[-]>[-]+>[-]++>[-]>[-]+>[-]+>[-]>[-]+>[-]>[-]+++>[-]>[-]+>>>>>>>>>>>>>>
>>>>>>[-]>>[-]++++++++++++++++>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<+]
29 changes: 29 additions & 0 deletions examples/http/server.bf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +561 to +567
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above says it moves to cell 51, but this comment here says it's 49?


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() =================================

>>>>>>>>>>>>>>>>>>[>]>>[-]<<<[[-]<]
Expand Down