mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add documentation to os2.close
Make it explicit that using a stream after closing is like a use-after-free bug.
This commit is contained in:
@@ -132,6 +132,12 @@ name :: proc(f: ^File) -> string {
|
|||||||
return _name(f)
|
return _name(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Close a file and its stream.
|
||||||
|
|
||||||
|
Any further use of the file or its stream should be considered to be in the
|
||||||
|
same class of bugs as a use-after-free.
|
||||||
|
*/
|
||||||
close :: proc(f: ^File) -> Error {
|
close :: proc(f: ^File) -> Error {
|
||||||
if f != nil {
|
if f != nil {
|
||||||
return io.close(f.stream)
|
return io.close(f.stream)
|
||||||
|
|||||||
Reference in New Issue
Block a user