mirror of https://github.com/containers/podman.git
libpod: fix a few minor staticcheck warnings
These: > libpod/container_copy_common.go:34:16: QF1011: could omit type bool from declaration; it will be inferred from the right-hand side (staticcheck) > locked bool = true > ^ > libpod/container_internal_common.go:793:3: QF1006: could lift into loop condition (staticcheck) > if maxSymLinks > 40 { > ^ > libpod/oci_conmon_linux.go:170:2: QF1007: could merge conditional assignment into variable declaration (staticcheck) > mustCreateCgroup := true > ^ Should not result in any change of logic. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
0105131b5c
commit
5aa035c69c
|
@ -31,7 +31,7 @@ func (c *Container) copyFromArchive(path string, chown, noOverwriteDirNonDir boo
|
||||||
unmount func()
|
unmount func()
|
||||||
cleanupFuncs []func()
|
cleanupFuncs []func()
|
||||||
err error
|
err error
|
||||||
locked bool = true
|
locked = true
|
||||||
)
|
)
|
||||||
|
|
||||||
// Make sure that "/" copies the *contents* of the mount point and not
|
// Make sure that "/" copies the *contents* of the mount point and not
|
||||||
|
|
|
@ -788,12 +788,9 @@ func (c *Container) isWorkDirSymlink(resolvedPath string) bool {
|
||||||
// If so, that's a valid use case: return nil.
|
// If so, that's a valid use case: return nil.
|
||||||
|
|
||||||
maxSymLinks := 0
|
maxSymLinks := 0
|
||||||
for {
|
// Linux only supports a chain of 40 links.
|
||||||
// Linux only supports a chain of 40 links.
|
// Reference: https://github.com/torvalds/linux/blob/master/include/linux/namei.h#L13
|
||||||
// Reference: https://github.com/torvalds/linux/blob/master/include/linux/namei.h#L13
|
for maxSymLinks <= 40 {
|
||||||
if maxSymLinks > 40 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
resolvedSymlink, err := os.Readlink(resolvedPath)
|
resolvedSymlink, err := os.Readlink(resolvedPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// End sym-link resolution loop.
|
// End sym-link resolution loop.
|
||||||
|
|
|
@ -167,11 +167,7 @@ func (r *ConmonOCIRuntime) withContainerSocketLabel(ctr *Container, closure func
|
||||||
// moveConmonToCgroupAndSignal gets a container's cgroupParent and moves the conmon process to that cgroup
|
// moveConmonToCgroupAndSignal gets a container's cgroupParent and moves the conmon process to that cgroup
|
||||||
// it then signals for conmon to start by sending nonce data down the start fd
|
// it then signals for conmon to start by sending nonce data down the start fd
|
||||||
func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec.Cmd, startFd *os.File) error {
|
func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec.Cmd, startFd *os.File) error {
|
||||||
mustCreateCgroup := true
|
mustCreateCgroup := !ctr.config.NoCgroups
|
||||||
|
|
||||||
if ctr.config.NoCgroups {
|
|
||||||
mustCreateCgroup = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// If cgroup creation is disabled - just signal.
|
// If cgroup creation is disabled - just signal.
|
||||||
switch ctr.config.CgroupsMode {
|
switch ctr.config.CgroupsMode {
|
||||||
|
|
Loading…
Reference in New Issue