Fix race in contStore.List

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
Alexandr Morozov 2014-06-05 10:49:40 +04:00
parent 4cf40c968f
commit 0b3fe55442
1 changed files with 2 additions and 0 deletions

View File

@ -72,9 +72,11 @@ func (c *contStore) Delete(id string) {
func (c *contStore) List() []*Container {
containers := new(History)
c.Lock()
for _, cont := range c.s {
containers.Add(cont)
}
c.Unlock()
containers.Sort()
return *containers
}