mirror of git://gcc.gnu.org/git/gcc.git
When closing a file, call closedir if we called opendir.
Fixes Go issue 1448. From-SVN: r169344
This commit is contained in:
parent
75d0b39856
commit
b91b9ad43e
|
|
@ -47,6 +47,13 @@ func (file *File) Close() Error {
|
||||||
if e := syscall.Close(file.fd); e != 0 {
|
if e := syscall.Close(file.fd); e != 0 {
|
||||||
err = &PathError{"close", file.name, Errno(e)}
|
err = &PathError{"close", file.name, Errno(e)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if file.dirinfo != nil {
|
||||||
|
if libc_closedir(file.dirinfo.dir) < 0 && err == nil {
|
||||||
|
err = &PathError{"closedir", file.name, Errno(syscall.GetErrno())}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
file.fd = -1 // so it can't be closed again
|
file.fd = -1 // so it can't be closed again
|
||||||
|
|
||||||
// no need for a finalizer anymore
|
// no need for a finalizer anymore
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue