mirror of
https://github.com/moby/moby.git
synced 2026-08-03 22:51:03 +00:00
fix(libnetwork): nil pointer will cause panic
make panic info more useful Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Sebastiaan van Stijn
parent
6bc6209b88
commit
dee7411f05
@@ -2,6 +2,7 @@ package ns
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
@@ -30,7 +31,8 @@ func initHandles() {
|
||||
}
|
||||
initNl, err = nlwrap.NewHandle(getSupportedNlFamilies()...)
|
||||
if err != nil {
|
||||
log.G(context.TODO()).Errorf("could not create netlink handle on initial namespace: %v", err)
|
||||
// Fail fast to keep the invariant: NlHandle must be a valid handle
|
||||
panic(fmt.Errorf("could not create netlink handle on initial (host) namespace: %w", err))
|
||||
}
|
||||
err = initNl.SetSocketTimeout(NetlinkSocketsTimeout)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user