Skip to content

Commit 20d35de

Browse files
authored
fixed IsReadable & IsWriteable
1 parent 09bdb07 commit 20d35de

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

php.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,19 +1556,23 @@ func Copy(source, dest string) (bool, error) {
15561556

15571557
// IsReadable is_readable()
15581558
func IsReadable(filename string) bool {
1559-
_, err := syscall.Open(filename, syscall.O_RDONLY, 0)
1559+
fd, err := syscall.Open(filename, syscall.O_RDONLY, 0)
15601560
if err != nil {
15611561
return false
15621562
}
1563+
syscall.Close(fd)
1564+
15631565
return true
15641566
}
15651567

15661568
// IsWriteable is_writeable()
15671569
func IsWriteable(filename string) bool {
1568-
_, err := syscall.Open(filename, syscall.O_WRONLY, 0)
1570+
fd, err := syscall.Open(filename, syscall.O_WRONLY, 0)
15691571
if err != nil {
15701572
return false
15711573
}
1574+
syscall.Close(fd)
1575+
15721576
return true
15731577
}
15741578

0 commit comments

Comments
 (0)