Avoid leaking fd in case fd.Stat() fails in the fall back implementation
of Getwd.
Change-Id: I8656d42e8dbc8893b7159873f173d6bf0d4febe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/256221
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Found:
pd, err := fd.Stat()
+ fd.Close()
if err != nil {
return "", err
}
- fd.Close()
if SameFile(pd, root) {
break
}