diff options
Diffstat (limited to 'src/pkg/os/file_windows.go')
-rw-r--r-- | src/pkg/os/file_windows.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pkg/os/file_windows.go b/src/pkg/os/file_windows.go index 74ff3eb88..80886f6f5 100644 --- a/src/pkg/os/file_windows.go +++ b/src/pkg/os/file_windows.go @@ -123,12 +123,12 @@ func (file *File) Stat() (fi *FileInfo, err Error) { } // Readdir reads the contents of the directory associated with file and -// returns an array of up to count FileInfo structures, as would be returned +// returns an array of up to n FileInfo structures, as would be returned // by Lstat, in directory order. Subsequent calls on the same file will yield // further FileInfos. // -// If n > 0, Readdir returns at most n names. In this case, if -// Readdirnames returns an empty slice, it will return a non-nil error +// If n > 0, Readdir returns at most n FileInfo structures. In this case, if +// Readdir returns an empty slice, it will return a non-nil error // explaining why. At the end of a directory, the error is os.EOF. // // If n <= 0, Readdir returns all the FileInfo from the directory in @@ -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. |