]> Cypherpunks repositories - gostls13.git/commitdiff
os: file windows use syscall.InvalidHandle instead of -1.
authorWei Guangjing <vcc.163@gmail.com>
Wed, 1 Feb 2012 23:17:52 +0000 (10:17 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 1 Feb 2012 23:17:52 +0000 (10:17 +1100)
R=golang-dev, adg, alex.brainman
CC=golang-dev
https://golang.org/cl/5602050

src/pkg/os/file_windows.go

index 7d39fdd2cd9b828e6063658d95039bb023cc8232..b84f210a6fd32596cab84df6bd7e336a350c7730 100644 (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() {