Browse code

Remove not needed call to container.readHostConfig()

Signed-off-by: Antonio Murdaca <me@runcom.ninja>

Antonio Murdaca authored on 2015/04/22 04:59:59
Showing 2 changed files
... ...
@@ -178,11 +178,13 @@ func (container *Container) readHostConfig() error {
178 178
 		return nil
179 179
 	}
180 180
 
181
-	data, err := ioutil.ReadFile(pth)
181
+	f, err := os.Open(pth)
182 182
 	if err != nil {
183 183
 		return err
184 184
 	}
185
-	return json.Unmarshal(data, container.hostConfig)
185
+	defer f.Close()
186
+
187
+	return json.NewDecoder(f).Decode(&container.hostConfig)
186 188
 }
187 189
 
188 190
 func (container *Container) WriteHostConfig() error {
... ...
@@ -194,8 +194,6 @@ func (daemon *Daemon) load(id string) (*Container, error) {
194 194
 		return container, fmt.Errorf("Container %s is stored at %s", container.ID, id)
195 195
 	}
196 196
 
197
-	container.readHostConfig()
198
-
199 197
 	return container, nil
200 198
 }
201 199