aboutsummaryrefslogtreecommitdiff
path: root/src/os/root_openat.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/root_openat.go')
-rw-r--r--src/os/root_openat.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/os/root_openat.go b/src/os/root_openat.go
index 192c29e319..e433bd5093 100644
--- a/src/os/root_openat.go
+++ b/src/os/root_openat.go
@@ -22,11 +22,10 @@ type root struct {
// refs is incremented while an operation is using fd.
// closed is set when Close is called.
// fd is closed when closed is true and refs is 0.
- mu sync.Mutex
- fd sysfdType
- refs int // number of active operations
- closed bool // set when closed
- cleanup runtime.Cleanup // cleanup closes the file when no longer referenced
+ mu sync.Mutex
+ fd sysfdType
+ refs int // number of active operations
+ closed bool // set when closed
}
func (r *root) Close() error {
@@ -36,9 +35,7 @@ func (r *root) Close() error {
syscall.Close(r.fd)
}
r.closed = true
- // There is no need for a cleanup at this point. Root must be alive at the point
- // where cleanup.stop is called.
- r.cleanup.Stop()
+ runtime.SetFinalizer(r, nil) // no need for a finalizer any more
return nil
}