]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix windows version of Readdir(0)
authorAlex Brainman <alex.brainman@gmail.com>
Sun, 29 May 2011 01:59:35 +0000 (11:59 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 29 May 2011 01:59:35 +0000 (11:59 +1000)
Fixes #1893.

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/4528106

src/pkg/os/file_windows.go

index 74ff3eb88ce16c470ff2eecccb1a66dcc43290ef..ac37b8e2d3496d88368b3526dc00a4ec579fe4b9 100644 (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.