mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #5630 from rjnagal/libcontainer-fixes
Check supplied hostname before using it.
This commit is contained in:
commit
818648ff9f
1 changed files with 4 additions and 2 deletions
|
@ -66,8 +66,10 @@ func Init(container *libcontainer.Container, uncleanRootfs, consolePath string,
|
|||
if err := mount.InitializeMountNamespace(rootfs, consolePath, container); err != nil {
|
||||
return fmt.Errorf("setup mount namespace %s", err)
|
||||
}
|
||||
if err := system.Sethostname(container.Hostname); err != nil {
|
||||
return fmt.Errorf("sethostname %s", err)
|
||||
if container.Hostname != "" {
|
||||
if err := system.Sethostname(container.Hostname); err != nil {
|
||||
return fmt.Errorf("sethostname %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
|
Loading…
Reference in a new issue