mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
fix resource leak in os.(*File).Close
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
This commit is contained in:
committed by
Ron Evans
parent
17bc0d6663
commit
85da9a0aac
@@ -267,6 +267,14 @@ func Pipe2(fds []int, flags int) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func closedir(dir uintptr) (err error) {
|
||||
e := libc_closedir(unsafe.Pointer(dir))
|
||||
if e != 0 {
|
||||
err = getErrno()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (err error) {
|
||||
e1 := libc_readdir_r(unsafe.Pointer(dir), unsafe.Pointer(entry), unsafe.Pointer(result))
|
||||
if e1 != 0 {
|
||||
|
||||
@@ -17,6 +17,11 @@ import (
|
||||
//export fdopendir$INODE64
|
||||
func libc_fdopendir(fd int32) unsafe.Pointer
|
||||
|
||||
// int closedir(struct DIR * buf);
|
||||
//
|
||||
//export closedir
|
||||
func libc_closedir(unsafe.Pointer) int32
|
||||
|
||||
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
|
||||
//
|
||||
//export readdir_r$INODE64
|
||||
|
||||
@@ -11,6 +11,11 @@ import (
|
||||
//export fdopendir
|
||||
func libc_fdopendir(fd int32) unsafe.Pointer
|
||||
|
||||
// int closedir(struct DIR * buf);
|
||||
//
|
||||
//export closedir
|
||||
func libc_closedir(unsafe.Pointer) int32
|
||||
|
||||
// int readdir_r(struct DIR * buf, struct dirent *entry, struct dirent **result);
|
||||
//
|
||||
//export readdir_r
|
||||
|
||||
Reference in New Issue
Block a user