os: document that users of Fd should keep f alive

Fixes #9046.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/162680043
This commit is contained in:
Russ Cox 2014-11-06 09:36:51 -05:00
parent 23ecad07cd
commit 1cdd9b407d
3 changed files with 4 additions and 1 deletions

View file

@ -29,6 +29,7 @@ type file struct {
}
// Fd returns the integer Unix file descriptor referencing the open file.
// The file descriptor is valid only until f.Close is called or f is garbage collected.
func (f *File) Fd() uintptr {
if f == nil {
return ^(uintptr(0))