summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/fs/inode_inotify.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/sentry/fs/inode_inotify.go b/pkg/sentry/fs/inode_inotify.go
index e213df924..d2b653bc7 100644
--- a/pkg/sentry/fs/inode_inotify.go
+++ b/pkg/sentry/fs/inode_inotify.go
@@ -39,9 +39,7 @@ type Watches struct {
}
func newWatches() *Watches {
- return &Watches{
- ws: make(map[uint64]*Watch),
- }
+ return &Watches{}
}
// MarkUnlinked indicates the target for this set of watches to be unlinked.
@@ -78,6 +76,9 @@ func (w *Watches) Add(watch *Watch) {
if _, exists := w.ws[watch.ID()]; exists {
panic(fmt.Sprintf("Watch collision with ID %+v", watch.ID()))
}
+ if w.ws == nil {
+ w.ws = make(map[uint64]*Watch)
+ }
w.ws[watch.ID()] = watch
}