diff options
author | Ruidong Cao <crdfrank@gmail.com> | 2019-02-28 16:43:59 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-28 16:44:54 -0800 |
commit | 3851705a73235baa6d153970c95921d17a39d77a (patch) | |
tree | d2840dc6b064f836c967e313bfb6841c16546e88 /pkg/sentry/fs/dentry.go | |
parent | f7df9d72cf1d10922ff5a55ef5664b4325439ef5 (diff) |
Fix procfs bugs
Current procfs has some bugs. After executing ls twice, many dirs come
out with same name like "1" or ".". Files like "cpuinfo" disappear.
Here variable names is a slice with cap() > len(). Sort after appending
to it will not alloc a new space and impact orignal slice. Same to m.
Signed-off-by: Ruidong Cao <crdfrank@gmail.com>
Change-Id: I83e5cd1c7968c6fe28c35ea4fee497488d4f9eef
PiperOrigin-RevId: 236222270
Diffstat (limited to 'pkg/sentry/fs/dentry.go')
-rw-r--r-- | pkg/sentry/fs/dentry.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/fs/dentry.go b/pkg/sentry/fs/dentry.go index ef6d1a870..4879df4d6 100644 --- a/pkg/sentry/fs/dentry.go +++ b/pkg/sentry/fs/dentry.go @@ -185,7 +185,8 @@ func NewSortedDentryMap(entries map[string]DentAttr) *SortedDentryMap { return s } -// GetAll returns all names and entries in s. +// GetAll returns all names and entries in s. Callers should not modify the +// returned values. func (s *SortedDentryMap) GetAll() ([]string, map[string]DentAttr) { return s.names, s.entries } |