Check supplied hostname before using it.
Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
This commit is contained in:
parent
ecb2b00021
commit
10b377c0fb
1 changed files with 4 additions and 2 deletions
|
@ -65,8 +65,10 @@ func Init(container *libcontainer.Container, uncleanRootfs, consolePath string,
|
||||||
if err := mount.InitializeMountNamespace(rootfs, consolePath, container); err != nil {
|
if err := mount.InitializeMountNamespace(rootfs, consolePath, container); err != nil {
|
||||||
return fmt.Errorf("setup mount namespace %s", err)
|
return fmt.Errorf("setup mount namespace %s", err)
|
||||||
}
|
}
|
||||||
if err := system.Sethostname(container.Hostname); err != nil {
|
if container.Hostname != "" {
|
||||||
return fmt.Errorf("sethostname %s", err)
|
if err := system.Sethostname(container.Hostname); err != nil {
|
||||||
|
return fmt.Errorf("sethostname %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := FinalizeNamespace(container); err != nil {
|
if err := FinalizeNamespace(container); err != nil {
|
||||||
return fmt.Errorf("finalize namespace %s", err)
|
return fmt.Errorf("finalize namespace %s", err)
|
||||||
|
|
Loading…
Reference in a new issue