diff options
author | Russ Cox <rsc@golang.org> | 2009-04-14 18:52:39 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-04-14 18:52:39 -0700 |
commit | 3d9cd0d5f993e3a26767d60ce4691bd7fd328e55 (patch) | |
tree | 1847c8ed95b9f392f16a46212d601fbbfd24e6e4 /src/lib/os/dir_amd64_darwin.go | |
parent | fbda86d1153881f71be157edca78c13e72634257 (diff) | |
download | golang-3d9cd0d5f993e3a26767d60ce4691bd7fd328e55.tar.gz |
fix infinite loop in Readdirnames: bufp > nbuf can happen
after EOF has been hit, because nbuf is now 0 or -1.
discard old comment.
R=r
DELTA=3 (0 added, 0 deleted, 3 changed)
OCL=27463
CL=27465
Diffstat (limited to 'src/lib/os/dir_amd64_darwin.go')
-rw-r--r-- | src/lib/os/dir_amd64_darwin.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/os/dir_amd64_darwin.go b/src/lib/os/dir_amd64_darwin.go index 76da8f4d9..903eb2878 100644 --- a/src/lib/os/dir_amd64_darwin.go +++ b/src/lib/os/dir_amd64_darwin.go @@ -31,7 +31,7 @@ func readdirnames(file *File, count int) (names []string, err *os.Error) { names = make([]string, 0, size); // Empty with room to grow. for count != 0 { // Refill the buffer if necessary - if d.bufp == d.nbuf { + if d.bufp >= d.nbuf { var errno int64; // Final argument is (basep *int64) and the syscall doesn't take nil. d.nbuf, errno = syscall.Getdirentries(file.fd, &d.buf[0], int64(len(d.buf)), new(int64)); |