mirror of
https://github.com/docker/cli.git
synced 2026-01-15 07:40:57 +03:00
Merge pull request #5833 from ActiveState/fix_nsinit_env_panic
fix panic when passing empty environment Upstream-commit: 62c3183fc88779479905df8c2f7561c46a08d2ee Component: engine
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user