Commit 4ea5d62e authored by Wei Guangjing's avatar Wei Guangjing Committed by Alex Brainman

os: file windows use syscall.InvalidHandle instead of -1.

R=golang-dev, adg, alex.brainman
CC=golang-dev
https://golang.org/cl/5602050
parent b2935330
...@@ -39,7 +39,7 @@ func (file *File) Fd() syscall.Handle { ...@@ -39,7 +39,7 @@ func (file *File) Fd() syscall.Handle {
// NewFile returns a new File with the given file descriptor and name. // NewFile returns a new File with the given file descriptor and name.
func NewFile(fd syscall.Handle, name string) *File { func NewFile(fd syscall.Handle, name string) *File {
if fd < 0 { if fd == syscall.InvalidHandle {
return nil return nil
} }
f := &File{&file{fd: fd, name: name}} f := &File{&file{fd: fd, name: name}}
...@@ -115,7 +115,7 @@ func (file *File) Close() error { ...@@ -115,7 +115,7 @@ func (file *File) Close() error {
} }
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 return EINVAL
} }
var e error var e error
...@@ -136,7 +136,7 @@ func (file *file) close() error { ...@@ -136,7 +136,7 @@ func (file *file) close() error {
} }
func (file *File) readdir(n int) (fi []FileInfo, err 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 return nil, EINVAL
} }
if !file.isdir() { if !file.isdir() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment