diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-06-03 11:31:24 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-06-03 11:31:24 +0200 |
commit | 56135c623a865c501ab31cc940c0e22ece2673f4 (patch) | |
tree | f69e04e82bbf75bdab0f624430ef265425e62b35 /src/pkg/os/file_windows.go | |
parent | 63d29fefab5290dc96e0a03ff70603aefa995887 (diff) | |
download | golang-56135c623a865c501ab31cc940c0e22ece2673f4.tar.gz |
Imported Upstream version 2011.06.02upstream-weekly/2011.06.02
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. |