Browse code

Fix race in get/set HostConfig

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)

Alexandr Morozov authored on 2014/06/05 16:17:09
Showing 1 changed files
... ...
@@ -808,11 +808,16 @@ func (container *Container) GetPtyMaster() (*os.File, error) {
808 808
 }
809 809
 
810 810
 func (container *Container) HostConfig() *runconfig.HostConfig {
811
-	return container.hostConfig
811
+	container.Lock()
812
+	res := container.hostConfig
813
+	container.Unlock()
814
+	return res
812 815
 }
813 816
 
814 817
 func (container *Container) SetHostConfig(hostConfig *runconfig.HostConfig) {
818
+	container.Lock()
815 819
 	container.hostConfig = hostConfig
820
+	container.Unlock()
816 821
 }
817 822
 
818 823
 func (container *Container) DisableLink(name string) {