1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #5833 from ActiveState/fix_nsinit_env_panic

fix panic when passing empty environment
This commit is contained in:
Michael Crosby 2014-05-16 12:03:26 -07:00
commit 62c3183fc8

View file

@ -152,6 +152,9 @@ func LoadContainerEnvironment(container *libcontainer.Container) error {
os.Clearenv()
for _, pair := range container.Env {
p := strings.SplitN(pair, "=", 2)
if len(p) < 2 {
return fmt.Errorf("invalid environment '%v'", pair)
}
if err := os.Setenv(p[0], p[1]); err != nil {
return err
}