Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
vc: Sandbox#Annotations should use annotationsLock read lock
Browse files Browse the repository at this point in the history
Fixes #2222

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
  • Loading branch information
yutedz committed Nov 19, 2019
1 parent 66f0ec5 commit 1afad1c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func (s *Sandbox) Logger() *logrus.Entry {

// Annotations returns any annotation that a user could have stored through the sandbox.
func (s *Sandbox) Annotations(key string) (string, error) {
s.annotationsLock.RLock()
defer s.annotationsLock.RUnlock()

value, exist := s.config.Annotations[key]
if !exist {
return "", fmt.Errorf("Annotations key %s does not exist", key)
Expand Down

0 comments on commit 1afad1c

Please sign in to comment.