Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
bc7ffb3e
Commit
bc7ffb3e
authored
Jul 05, 2019
by
Arnim Läuger
Committed by
Marcel Stör
Jul 05, 2019
Browse files
fix unref default file descriptor while still in use (#2818)
parent
7de8a017
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/file.c
View file @
bc7ffb3e
...
...
@@ -126,15 +126,16 @@ static int file_close( lua_State* L )
ud
=
(
file_fd_ud
*
)
luaL_checkudata
(
L
,
1
,
"file.obj"
);
}
// unref default file descriptor
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
file_fd_ref
);
file_fd_ref
=
LUA_NOREF
;
if
(
ud
->
fd
){
vfs_close
(
ud
->
fd
);
// mark as closed
ud
->
fd
=
0
;
}
// unref default file descriptor
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
file_fd_ref
);
file_fd_ref
=
LUA_NOREF
;
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment