summaryrefslogtreecommitdiff
path: root/src/pkg/os/dir_unix.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-06-03 11:31:24 +0200
committerOndřej Surý <ondrej@sury.org>2011-06-03 11:31:24 +0200
commit56135c623a865c501ab31cc940c0e22ece2673f4 (patch)
treef69e04e82bbf75bdab0f624430ef265425e62b35 /src/pkg/os/dir_unix.go
parent63d29fefab5290dc96e0a03ff70603aefa995887 (diff)
downloadgolang-56135c623a865c501ab31cc940c0e22ece2673f4.tar.gz
Imported Upstream version 2011.06.02upstream-weekly/2011.06.02
Diffstat (limited to 'src/pkg/os/dir_unix.go')
-rw-r--r--src/pkg/os/dir_unix.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pkg/os/dir_unix.go b/src/pkg/os/dir_unix.go
index 9c543838e..7835ed52b 100644
--- a/src/pkg/os/dir_unix.go
+++ b/src/pkg/os/dir_unix.go
@@ -32,11 +32,11 @@ func (f *File) Readdirnames(n int) (names []string, err Error) {
f.dirinfo.buf = make([]byte, blockSize)
}
d := f.dirinfo
- wantAll := n < 0
size := n
- if size < 0 {
+ if size <= 0 {
size = 100
+ n = -1
}
names = make([]string, 0, size) // Empty with room to grow.
@@ -60,7 +60,7 @@ func (f *File) Readdirnames(n int) (names []string, err Error) {
d.bufp += nb
n -= nc
}
- if !wantAll && len(names) == 0 {
+ if n >= 0 && len(names) == 0 {
return names, EOF
}
return names, nil