mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 04:38:16 +00:00
fix os.read_dir closing the given file descriptor
This commit is contained in:
@@ -5,10 +5,12 @@ import "core:strings"
|
||||
|
||||
@(require_results)
|
||||
read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Error) {
|
||||
dirp := _fdopendir(fd) or_return
|
||||
dupfd := _dup(fd) or_return
|
||||
|
||||
dirp := _fdopendir(dupfd) or_return
|
||||
defer _closedir(dirp)
|
||||
|
||||
dirpath := absolute_path_from_handle(fd) or_return
|
||||
dirpath := absolute_path_from_handle(dupfd) or_return
|
||||
defer delete(dirpath)
|
||||
|
||||
n := n
|
||||
|
||||
Reference in New Issue
Block a user