syscall: change windows apis with bool return value to return errno instead
This change is to make these apis similar to their unix counterparts.
R=rsc
CC=golang-dev
https://golang.org/cl/4185042
diff --git a/src/pkg/os/file_windows.go b/src/pkg/os/file_windows.go
index bf710bb..d14c38e 100644
--- a/src/pkg/os/file_windows.go
+++ b/src/pkg/os/file_windows.go
@@ -83,9 +83,9 @@
}
var e int
if file.isdir() {
- _, e = syscall.FindClose(int32(file.fd))
+ e = syscall.FindClose(int32(file.fd))
} else {
- _, e = syscall.CloseHandle(int32(file.fd))
+ e = syscall.CloseHandle(int32(file.fd))
}
var err Error
if e != 0 {
@@ -100,7 +100,8 @@
func (file *File) statFile(name string) (fi *FileInfo, err Error) {
var stat syscall.ByHandleFileInformation
- if ok, e := syscall.GetFileInformationByHandle(int32(file.fd), &stat); !ok {
+ e := syscall.GetFileInformationByHandle(int32(file.fd), &stat)
+ if e != 0 {
return nil, &PathError{"stat", file.name, Errno(e)}
}
return fileInfoFromByHandleInfo(new(FileInfo), file.name, &stat), nil
@@ -142,7 +143,7 @@
if di.usefirststat {
di.usefirststat = false
} else {
- _, e := syscall.FindNextFile(int32(file.fd), &di.stat.Windata)
+ e := syscall.FindNextFile(int32(file.fd), &di.stat.Windata)
if e != 0 {
if e == syscall.ERROR_NO_MORE_FILES {
break