summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-07-03 15:37:17 -0500
committerbaude <bbaude@redhat.com>2019-07-08 09:18:11 -0500
commit1d36501f961889f554daf3c696fe95443ef211b6 (patch)
tree4a8d7aa79f46a0096ad7952f1390d6909a9d894b /libpod/networking_linux.go
parentf7407f2eb512e1407f8281009eb829f37405119b (diff)
downloadpodman-1d36501f961889f554daf3c696fe95443ef211b6.tar.gz
podman-1d36501f961889f554daf3c696fe95443ef211b6.tar.bz2
podman-1d36501f961889f554daf3c696fe95443ef211b6.zip
code cleanup
clean up code identified as problematic by golands inspection Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go12
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.