mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #981 from tanjianfeng:fix-898
PiperOrigin-RevId: 282669859
This commit is contained in:
@@ -956,14 +956,14 @@ func (l *localFile) Readdir(offset uint64, count uint32) ([]p9.Dirent, error) {
|
||||
}
|
||||
|
||||
func (l *localFile) readDirent(f int, offset uint64, count uint32, skip uint64) ([]p9.Dirent, error) {
|
||||
var dirents []p9.Dirent
|
||||
|
||||
// Limit 'count' to cap the slice size that is returned.
|
||||
const maxCount = 100000
|
||||
if count > maxCount {
|
||||
count = maxCount
|
||||
}
|
||||
|
||||
dirents := make([]p9.Dirent, 0, count)
|
||||
|
||||
// Pre-allocate buffers that will be reused to get partial results.
|
||||
direntsBuf := make([]byte, 8192)
|
||||
names := make([]string, 0, 100)
|
||||
|
||||
Reference in New Issue
Block a user