mirror of
https://github.com/golang/go.git
synced 2025-10-28 07:14:14 +00:00
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
This commit is contained in:
parent
ca9765d83a
commit
ff73221d6f
3 changed files with 3 additions and 3 deletions
|
|
@ -40,7 +40,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;
|
||||
dbuf := (*syscall.Dirent)(unsafe.Pointer(&d.buf[0]));
|
||||
d.nbuf, errno = syscall.Getdents(file.fd, dbuf, int64(len(d.buf)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue