1
0
mirror of https://github.com/golang/go synced 2024-11-25 01:08:02 -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:
Wei Guangjing 2012-02-02 10:17:52 +11:00 committed by Alex Brainman
parent b2935330b0
commit 4ea5d62e5a

View File

@ -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() {