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
1f1eeaf3
Commit
1f1eeaf3
authored
Jul 03, 2019
by
devsaurus
Browse files
fix unref default file descriptor while still in use
parent
51912d55
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/file.c
View file @
1f1eeaf3
...
@@ -123,15 +123,16 @@ static int file_close( lua_State* L )
...
@@ -123,15 +123,16 @@ static int file_close( lua_State* L )
ud
=
(
file_fd_ud
*
)
luaL_checkudata
(
L
,
1
,
"file.obj"
);
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
){
if
(
ud
->
fd
){
vfs_close
(
ud
->
fd
);
vfs_close
(
ud
->
fd
);
// mark as closed
// mark as closed
ud
->
fd
=
0
;
ud
->
fd
=
0
;
}
}
// unref default file descriptor
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
file_fd_ref
);
file_fd_ref
=
LUA_NOREF
;
return
0
;
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