os: fail if Open("") is called on windows
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5432071
diff --git a/src/pkg/os/file_windows.go b/src/pkg/os/file_windows.go
index 3a252fb..81fdbe3 100644
--- a/src/pkg/os/file_windows.go
+++ b/src/pkg/os/file_windows.go
@@ -89,6 +89,9 @@
// methods on the returned File can be used for I/O.
// It returns the File and an error, if any.
func OpenFile(name string, flag int, perm uint32) (file *File, err error) {
+ if name == "" {
+ return nil, &PathError{"open", name, syscall.ENOENT}
+ }
// TODO(brainman): not sure about my logic of assuming it is dir first, then fall back to file
r, e := openDir(name)
if e == nil {