mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Do not print the word nil
in a log.
Because it doesn't mean anything. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
parent
94453a45cb
commit
d216db6ef2
1 changed files with 9 additions and 9 deletions
|
@ -244,13 +244,8 @@ func (n *networkNamespace) InvokeFunc(f func()) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLink() string {
|
func getLink() (string, error) {
|
||||||
l, err := os.Readlink(fmt.Sprintf("/proc/%d/task/%d/ns/net", os.Getpid(), syscall.Gettid()))
|
return os.Readlink(fmt.Sprintf("/proc/%d/task/%d/ns/net", os.Getpid(), syscall.Gettid()))
|
||||||
if err != nil {
|
|
||||||
return fmt.Sprintf("(nil: %v)", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return l
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func nsInit() {
|
func nsInit() {
|
||||||
|
@ -266,8 +261,13 @@ func InitOSContext() func() {
|
||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
nsOnce.Do(nsInit)
|
nsOnce.Do(nsInit)
|
||||||
if err := netns.Set(initNs); err != nil {
|
if err := netns.Set(initNs); err != nil {
|
||||||
log.Errorf("failed to set to initial namespace, link %s, initns fd %d: %v",
|
linkInfo, linkErr := getLink()
|
||||||
getLink(), initNs, err)
|
if linkErr != nil {
|
||||||
|
linkInfo = linkErr.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Errorf("failed to set to initial namespace, %v, initns fd %d: %v",
|
||||||
|
linkInfo, initNs, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return runtime.UnlockOSThread
|
return runtime.UnlockOSThread
|
||||||
|
|
Loading…
Reference in a new issue