From 505f0bb3ce55871b7c79cfcd34fa468f5cee73ef Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Sun, 29 May 2011 11:59:35 +1000 Subject: [PATCH] os: fix windows version of Readdir(0) Fixes #1893. R=golang-dev CC=bradfitz, golang-dev https://golang.org/cl/4528106 --- src/pkg/os/file_windows.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkg/os/file_windows.go b/src/pkg/os/file_windows.go index 74ff3eb88ce..ac37b8e2d34 100644 --- a/src/pkg/os/file_windows.go +++ b/src/pkg/os/file_windows.go @@ -145,9 +145,10 @@ func (file *File) Readdir(n int) (fi []FileInfo, err Error) { return nil, &PathError{"Readdir", file.name, ENOTDIR} } di := file.dirinfo - wantAll := n < 0 + wantAll := n <= 0 size := n - if size < 0 { + if wantAll { + n = -1 size = 100 } fi = make([]FileInfo, 0, size) // Empty with room to grow.