mirror of
https://github.com/containers/podman.git
synced 2025-10-26 10:45:26 +08:00
Lint: Do not ignore errors from docker run command when selinux enabled
Redefining err by := operator within block makes this err variable block local.
Addressing lint:
libpod/oci.go:368:3⚠️ ineffectual assignment to err (ineffassign)
Signed-off-by: Šimon Lukašík <slukasik@redhat.com>
This commit is contained in:
@ -350,7 +350,8 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
|
|||||||
// Set the label of the conmon process to be level :s0
|
// Set the label of the conmon process to be level :s0
|
||||||
// This will allow the container processes to talk to fifo-files
|
// This will allow the container processes to talk to fifo-files
|
||||||
// passed into the container by conmon
|
// passed into the container by conmon
|
||||||
plabel, err := selinux.CurrentLabel()
|
var plabel string
|
||||||
|
plabel, err = selinux.CurrentLabel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
childPipe.Close()
|
childPipe.Close()
|
||||||
return errors.Wrapf(err, "Failed to get current SELinux label")
|
return errors.Wrapf(err, "Failed to get current SELinux label")
|
||||||
@ -360,7 +361,7 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
|
|||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
if c["level"] != "s0" && c["level"] != "" {
|
if c["level"] != "s0" && c["level"] != "" {
|
||||||
c["level"] = "s0"
|
c["level"] = "s0"
|
||||||
if err := label.SetProcessLabel(c.Get()); err != nil {
|
if err = label.SetProcessLabel(c.Get()); err != nil {
|
||||||
runtime.UnlockOSThread()
|
runtime.UnlockOSThread()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user