1
0
mirror of https://github.com/golang/go synced 2024-11-24 20:10:02 -07:00

os: fix windows version of Readdir(0)

Fixes #1893.

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/4528106
This commit is contained in:
Alex Brainman 2011-05-29 11:59:35 +10:00
parent b7582852f6
commit 505f0bb3ce

View File

@ -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.