mirror of
https://github.com/golang/go
synced 2024-11-25 03:27:58 -07:00
os: file windows use syscall.InvalidHandle instead of -1.
R=golang-dev, adg, alex.brainman CC=golang-dev https://golang.org/cl/5602050
This commit is contained in:
parent
b2935330b0
commit
4ea5d62e5a
@ -39,7 +39,7 @@ func (file *File) Fd() syscall.Handle {
|
||||
|
||||
// NewFile returns a new File with the given file descriptor and name.
|
||||
func NewFile(fd syscall.Handle, name string) *File {
|
||||
if fd < 0 {
|
||||
if fd == syscall.InvalidHandle {
|
||||
return nil
|
||||
}
|
||||
f := &File{&file{fd: fd, name: name}}
|
||||
@ -115,7 +115,7 @@ func (file *File) Close() error {
|
||||
}
|
||||
|
||||
func (file *file) close() error {
|
||||
if file == nil || file.fd < 0 {
|
||||
if file == nil || file.fd == syscall.InvalidHandle {
|
||||
return EINVAL
|
||||
}
|
||||
var e error
|
||||
@ -136,7 +136,7 @@ func (file *file) close() error {
|
||||
}
|
||||
|
||||
func (file *File) readdir(n int) (fi []FileInfo, err error) {
|
||||
if file == nil || file.fd < 0 {
|
||||
if file == nil || file.fd == syscall.InvalidHandle {
|
||||
return nil, EINVAL
|
||||
}
|
||||
if !file.isdir() {
|
||||
|
Loading…
Reference in New Issue
Block a user