diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-08 18:00:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-08 18:00:11 +0200 |
commit | ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b (patch) | |
tree | 2ef0f0a0c9f3c2cd8798dee04de8c3d5ab292c36 /libpod/networking_linux.go | |
parent | 1055b22e9b900e5f4d41f39b506de4f2d1aa2f8e (diff) | |
parent | 1d36501f961889f554daf3c696fe95443ef211b6 (diff) | |
download | podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.tar.gz podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.tar.bz2 podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.zip |
Merge pull request #3496 from baude/golandcodeinspect
code cleanup
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r-- | libpod/networking_linux.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 27585b8d5..d978bceed 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -294,14 +294,14 @@ func (r *Runtime) setupRootlessNetNS(ctr *Container) (err error) { return errors.Wrapf(err, "cannot shutdown the socket %s", apiSocket) } buf := make([]byte, 2048) - len, err := conn.Read(buf) + readLength, err := conn.Read(buf) if err != nil { return errors.Wrapf(err, "cannot read from control socket %s", apiSocket) } // if there is no 'error' key in the received JSON data, then the operation was // successful. var y map[string]interface{} - if err := json.Unmarshal(buf[0:len], &y); err != nil { + if err := json.Unmarshal(buf[0:readLength], &y); err != nil { return errors.Wrapf(err, "error parsing error status from slirp4netns") } if e, found := y["error"]; found { @@ -332,7 +332,9 @@ func (r *Runtime) setupNetNS(ctr *Container) (err error) { if err != nil { return errors.Wrapf(err, "cannot open %s", nsPath) } - mountPointFd.Close() + if err := mountPointFd.Close(); err != nil { + return err + } if err := unix.Mount(nsProcess, nsPath, "none", unix.MS_BIND, ""); err != nil { return errors.Wrapf(err, "cannot mount %s", nsPath) @@ -352,12 +354,12 @@ func (r *Runtime) setupNetNS(ctr *Container) (err error) { // Join an existing network namespace func joinNetNS(path string) (ns.NetNS, error) { - ns, err := ns.GetNS(path) + netNS, err := ns.GetNS(path) if err != nil { return nil, errors.Wrapf(err, "error retrieving network namespace at %s", path) } - return ns, nil + return netNS, nil } // Close a network namespace. |