summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-11 21:35:45 +0200
committerGitHub <noreply@github.com>2019-07-11 21:35:45 +0200
commitd614372c2f39cea32641ec92c84a9e48657cfb41 (patch)
tree032338943b478c70e6ded7c103cea0311481cca8 /libpod/networking_linux.go
parent2b64f8844655b7188332a404ec85d32c33feb9e9 (diff)
parenta78c885397ad2938b9b21438bcfa8a00dd1eb03f (diff)
downloadpodman-d614372c2f39cea32641ec92c84a9e48657cfb41.tar.gz
podman-d614372c2f39cea32641ec92c84a9e48657cfb41.tar.bz2
podman-d614372c2f39cea32641ec92c84a9e48657cfb41.zip
Merge pull request #3552 from baude/golangcilint2
golangci-lint pass number 2
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 987c1fc5b..bef3f7739 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -5,7 +5,6 @@ package libpod
import (
"crypto/rand"
"fmt"
- "github.com/containers/libpod/pkg/errorhandling"
"net"
"os"
"os/exec"
@@ -17,6 +16,7 @@ import (
cnitypes "github.com/containernetworking/cni/pkg/types/current"
"github.com/containernetworking/plugins/pkg/ns"
+ "github.com/containers/libpod/pkg/errorhandling"
"github.com/containers/libpod/pkg/firewall"
"github.com/containers/libpod/pkg/netns"
"github.com/containers/libpod/pkg/rootless"
@@ -151,8 +151,8 @@ func checkSlirpFlags(path string) (bool, bool, error) {
// Configure the network namespace for a rootless container
func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
- defer ctr.rootlessSlirpSyncR.Close()
- defer ctr.rootlessSlirpSyncW.Close()
+ defer errorhandling.CloseQuiet(ctr.rootlessSlirpSyncR)
+ defer errorhandling.CloseQuiet(ctr.rootlessSlirpSyncW)
path := r.config.NetworkCmdPath
@@ -201,7 +201,11 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
if err := cmd.Start(); err != nil {
return errors.Wrapf(err, "failed to start slirp4netns process")
}
- defer cmd.Process.Release()
+ defer func() {
+ if err := cmd.Process.Release(); err != nil {
+ logrus.Errorf("unable to release comman process: %q", err)
+ }
+ }()
b := make([]byte, 16)
for {
@@ -268,7 +272,11 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) {
if err != nil {
return errors.Wrapf(err, "cannot open connection to %s", apiSocket)
}
- defer conn.Close()
+ defer func() {
+ if err := conn.Close(); err != nil {
+ logrus.Errorf("unable to close connection: %q", err)
+ }
+ }()
hostIP := i.HostIP
if hostIP == "" {
hostIP = "0.0.0.0"