(read_dirstream): Fix braino: fill in the buffer when not reallocating it!

This commit is contained in:
Roland McGrath 1995-12-12 05:48:31 +00:00
parent 737e056a89
commit 5df0d41985

4
dir.c
View file

@ -616,8 +616,9 @@ read_dirstream (stream)
if (sizeof *d - sizeof d->d_name + len > bufsz) if (sizeof *d - sizeof d->d_name + len > bufsz)
bufsz = sizeof *d - sizeof d->d_name + len; bufsz = sizeof *d - sizeof d->d_name + len;
buf = xmalloc (bufsz); buf = xmalloc (bufsz);
}
d = (struct dirent *) buf; d = (struct dirent *) buf;
d->d_ino = 1; FAKE_DIR_ENTRY (d);
#ifdef HAVE_D_NAMLEN #ifdef HAVE_D_NAMLEN
d->d_namlen = len - 1; d->d_namlen = len - 1;
#endif #endif
@ -625,7 +626,6 @@ read_dirstream (stream)
return d; return d;
} }
} }
}
if (++ds->bucket == DIRFILE_BUCKETS) if (++ds->bucket == DIRFILE_BUCKETS)
break; break;
ds->elt = ds->contents->files[ds->bucket]; ds->elt = ds->contents->files[ds->bucket];