mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
linter: enable unconvert linter
Detects unneccessary type conversions and helps in keeping the code base cleaner. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -44,7 +44,6 @@ linters:
|
|||||||
- goconst
|
- goconst
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- lll
|
- lll
|
||||||
- unconvert
|
|
||||||
- gosec
|
- gosec
|
||||||
- maligned
|
- maligned
|
||||||
- gomoddirectives
|
- gomoddirectives
|
||||||
|
@ -28,8 +28,8 @@ func TestPodOptions(t *testing.T) {
|
|||||||
for j := 0; j < cc.NumField(); j++ {
|
for j := 0; j < cc.NumField(); j++ {
|
||||||
containerField := cc.FieldByIndex([]int{j})
|
containerField := cc.FieldByIndex([]int{j})
|
||||||
containerType := reflect.TypeOf(exampleOptions).Field(j)
|
containerType := reflect.TypeOf(exampleOptions).Field(j)
|
||||||
tagPod := strings.Split(string(podType.Tag.Get("json")), ",")[0]
|
tagPod := strings.Split(podType.Tag.Get("json"), ",")[0]
|
||||||
tagContainer := strings.Split(string(containerType.Tag.Get("json")), ",")[0]
|
tagContainer := strings.Split(containerType.Tag.Get("json"), ",")[0]
|
||||||
if tagPod == tagContainer && (tagPod != "" && tagContainer != "") {
|
if tagPod == tagContainer && (tagPod != "" && tagContainer != "") {
|
||||||
areEqual := true
|
areEqual := true
|
||||||
if containerField.Kind() == podField.Kind() {
|
if containerField.Kind() == podField.Kind() {
|
||||||
|
@ -95,7 +95,7 @@ func kill(_ *cobra.Command, args []string) error {
|
|||||||
return errors.New("valid signals are 1 through 64")
|
return errors.New("valid signals are 1 through 64")
|
||||||
}
|
}
|
||||||
for _, cidFile := range cidFiles {
|
for _, cidFile := range cidFiles {
|
||||||
content, err := ioutil.ReadFile(string(cidFile))
|
content, err := ioutil.ReadFile(cidFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error reading CIDFile")
|
return errors.Wrap(err, "error reading CIDFile")
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func rm(cmd *cobra.Command, args []string) error {
|
|||||||
rmOptions.Timeout = &stopTimeout
|
rmOptions.Timeout = &stopTimeout
|
||||||
}
|
}
|
||||||
for _, cidFile := range cidFiles {
|
for _, cidFile := range cidFiles {
|
||||||
content, err := ioutil.ReadFile(string(cidFile))
|
content, err := ioutil.ReadFile(cidFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error reading CIDFile")
|
return errors.Wrap(err, "error reading CIDFile")
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func stop(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, cidFile := range cidFiles {
|
for _, cidFile := range cidFiles {
|
||||||
content, err := ioutil.ReadFile(string(cidFile))
|
content, err := ioutil.ReadFile(cidFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error reading CIDFile")
|
return errors.Wrap(err, "error reading CIDFile")
|
||||||
}
|
}
|
||||||
|
@ -3282,7 +3282,7 @@ func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
stat := st.Sys().(*syscall.Stat_t)
|
stat := st.Sys().(*syscall.Stat_t)
|
||||||
atime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec))
|
atime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
|
||||||
if err := os.Chtimes(mountPoint, atime, st.ModTime()); err != nil {
|
if err := os.Chtimes(mountPoint, atime, st.ModTime()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
utils.InternalServerError(w, err)
|
utils.InternalServerError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL {
|
if sig == 0 || sig == syscall.SIGKILL {
|
||||||
opts := entities.WaitOptions{
|
opts := entities.WaitOptions{
|
||||||
Condition: []define.ContainerStatus{define.ContainerStateExited, define.ContainerStateStopped},
|
Condition: []define.ContainerStatus{define.ContainerStateExited, define.ContainerStateStopped},
|
||||||
Interval: time.Millisecond * 250,
|
Interval: time.Millisecond * 250,
|
||||||
@ -341,8 +341,8 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
|
|||||||
for idx, portMapping := range portMappings {
|
for idx, portMapping := range portMappings {
|
||||||
ports[idx] = types.Port{
|
ports[idx] = types.Port{
|
||||||
IP: portMapping.HostIP,
|
IP: portMapping.HostIP,
|
||||||
PrivatePort: uint16(portMapping.ContainerPort),
|
PrivatePort: portMapping.ContainerPort,
|
||||||
PublicPort: uint16(portMapping.HostPort),
|
PublicPort: portMapping.HostPort,
|
||||||
Type: portMapping.Protocol,
|
Type: portMapping.Protocol,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
Output: output,
|
Output: output,
|
||||||
OutputFormat: format,
|
OutputFormat: format,
|
||||||
PullPolicy: pullPolicy,
|
PullPolicy: pullPolicy,
|
||||||
PullPushRetryDelay: time.Duration(2 * time.Second),
|
PullPushRetryDelay: 2 * time.Second,
|
||||||
Quiet: query.Quiet,
|
Quiet: query.Quiet,
|
||||||
Registry: registry,
|
Registry: registry,
|
||||||
RemoveIntermediateCtrs: query.Rm,
|
RemoveIntermediateCtrs: query.Rm,
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func checkHardLink(fi os.FileInfo) (devino, bool) {
|
func checkHardLink(fi os.FileInfo) (devino, bool) {
|
||||||
st := fi.Sys().(*syscall.Stat_t)
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
return devino{
|
return devino{
|
||||||
Dev: uint64(st.Dev),
|
Dev: uint64(st.Dev), // nolint: unconvert
|
||||||
Ino: uint64(st.Ino),
|
Ino: st.Ino,
|
||||||
}, st.Nlink > 1
|
}, st.Nlink > 1
|
||||||
}
|
}
|
||||||
|
@ -1113,7 +1113,7 @@ func (ic *ContainerEngine) GetContainerExitCode(ctx context.Context, ctr *libpod
|
|||||||
time.Sleep(250 * time.Millisecond)
|
time.Sleep(250 * time.Millisecond)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return int(event.ContainerExitCode)
|
return event.ContainerExitCode
|
||||||
}
|
}
|
||||||
logrus.Errorf("Could not retrieve exit code from event: %v", err)
|
logrus.Errorf("Could not retrieve exit code from event: %v", err)
|
||||||
return define.ExecErrorCodeNotFound
|
return define.ExecErrorCodeNotFound
|
||||||
|
@ -43,7 +43,7 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "cannot convert inodes %s to integer", splitO[1])
|
return nil, errors.Wrapf(err, "cannot convert inodes %s to integer", splitO[1])
|
||||||
}
|
}
|
||||||
libpodOptions = append(libpodOptions, libpod.WithVolumeInodes(uint64(inodes)))
|
libpodOptions = append(libpodOptions, libpod.WithVolumeInodes(inodes))
|
||||||
finalVal = append(finalVal, o)
|
finalVal = append(finalVal, o)
|
||||||
// set option "INODES": "$size"
|
// set option "INODES": "$size"
|
||||||
volumeOptions["INODES"] = splitO[1]
|
volumeOptions["INODES"] = splitO[1]
|
||||||
|
@ -216,9 +216,9 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
|
|||||||
Tag: stat.Tag,
|
Tag: stat.Tag,
|
||||||
ImageID: stat.ID,
|
ImageID: stat.ID,
|
||||||
Created: stat.Created,
|
Created: stat.Created,
|
||||||
Size: int64(stat.Size),
|
Size: stat.Size,
|
||||||
SharedSize: int64(stat.SharedSize),
|
SharedSize: stat.SharedSize,
|
||||||
UniqueSize: int64(stat.UniqueSize),
|
UniqueSize: stat.UniqueSize,
|
||||||
Containers: stat.Containers,
|
Containers: stat.Containers,
|
||||||
}
|
}
|
||||||
dfImages = append(dfImages, &report)
|
dfImages = append(dfImages, &report)
|
||||||
|
@ -221,7 +221,7 @@ func (a int64Amount) AsCanonicalBytes(out []byte) (result []byte, exponent int32
|
|||||||
exponent = int32(a.scale)
|
exponent = int32(a.scale)
|
||||||
|
|
||||||
amount, times := removeInt64Factors(mantissa, 10)
|
amount, times := removeInt64Factors(mantissa, 10)
|
||||||
exponent += int32(times)
|
exponent += times
|
||||||
|
|
||||||
// make sure exponent is a multiple of 3
|
// make sure exponent is a multiple of 3
|
||||||
var ok bool
|
var ok bool
|
||||||
|
@ -293,7 +293,7 @@ func ParseQuantity(str string) (Quantity, error) {
|
|||||||
switch {
|
switch {
|
||||||
case exponent >= 0 && len(denom) == 0:
|
case exponent >= 0 && len(denom) == 0:
|
||||||
// only handle positive binary numbers with the fast path
|
// only handle positive binary numbers with the fast path
|
||||||
mantissa = int64(int64(mantissa) << uint64(exponent))
|
mantissa <<= uint64(exponent)
|
||||||
// 1Mi (2^20) has ~6 digits of decimal precision, so exponent*3/10 -1 is roughly the precision
|
// 1Mi (2^20) has ~6 digits of decimal precision, so exponent*3/10 -1 is roughly the precision
|
||||||
precision = 15 - int32(len(num)) - int32(float32(exponent)*3/10) - 1
|
precision = 15 - int32(len(num)) - int32(float32(exponent)*3/10) - 1
|
||||||
default:
|
default:
|
||||||
@ -313,7 +313,7 @@ func ParseQuantity(str string) (Quantity, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return Quantity{}, ErrNumeric
|
return Quantity{}, ErrNumeric
|
||||||
}
|
}
|
||||||
if result, ok := int64Multiply(value, int64(mantissa)); ok {
|
if result, ok := int64Multiply(value, mantissa); ok {
|
||||||
if !positive {
|
if !positive {
|
||||||
result = -result
|
result = -result
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ func deviceFromPath(path string) (*spec.LinuxDevice, error) {
|
|||||||
var (
|
var (
|
||||||
devType string
|
devType string
|
||||||
mode = stat.Mode
|
mode = stat.Mode
|
||||||
devNumber = uint64(stat.Rdev)
|
devNumber = uint64(stat.Rdev) // nolint: unconvert
|
||||||
m = os.FileMode(mode)
|
m = os.FileMode(mode)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error {
|
|||||||
if err := unix.Stat(k, &statT); err != nil {
|
if err := unix.Stat(k, &statT); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Major = (int64(unix.Major(uint64(statT.Rdev))))
|
v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
|
v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
if s.ResourceLimits.BlockIO == nil {
|
if s.ResourceLimits.BlockIO == nil {
|
||||||
s.ResourceLimits.BlockIO = new(spec.LinuxBlockIO)
|
s.ResourceLimits.BlockIO = new(spec.LinuxBlockIO)
|
||||||
}
|
}
|
||||||
@ -317,8 +317,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error {
|
|||||||
if err := unix.Stat(k, &statT); err != nil {
|
if err := unix.Stat(k, &statT); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Major = (int64(unix.Major(uint64(statT.Rdev))))
|
v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
|
v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice, v)
|
s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,8 +328,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error {
|
|||||||
if err := unix.Stat(k, &statT); err != nil {
|
if err := unix.Stat(k, &statT); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Major = (int64(unix.Major(uint64(statT.Rdev))))
|
v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
|
v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice, v)
|
s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,8 +339,8 @@ func FinishThrottleDevices(s *specgen.SpecGenerator) error {
|
|||||||
if err := unix.Stat(k, &statT); err != nil {
|
if err := unix.Stat(k, &statT); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
v.Major = (int64(unix.Major(uint64(statT.Rdev))))
|
v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
v.Minor = (int64(unix.Minor(uint64(statT.Rdev))))
|
v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
|
||||||
s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice, v)
|
s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
|
|||||||
if err := unix.Stat(k, &statT); err != nil {
|
if err := unix.Stat(k, &statT); err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to inspect '%s' in --blkio-weight-device", k)
|
return nil, errors.Wrapf(err, "failed to inspect '%s' in --blkio-weight-device", k)
|
||||||
}
|
}
|
||||||
g.AddLinuxResourcesBlockIOWeightDevice((int64(unix.Major(uint64(statT.Rdev)))), (int64(unix.Minor(uint64(statT.Rdev)))), *v.Weight)
|
g.AddLinuxResourcesBlockIOWeightDevice((int64(unix.Major(uint64(statT.Rdev)))), (int64(unix.Minor(uint64(statT.Rdev)))), *v.Weight) // nolint: unconvert
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockAccessToKernelFilesystems(s.Privileged, s.PidNS.IsHost(), s.Mask, s.Unmask, &g)
|
BlockAccessToKernelFilesystems(s.Privileged, s.PidNS.IsHost(), s.Mask, s.Unmask, &g)
|
||||||
|
@ -142,7 +142,7 @@ var _ = Describe("Podman login and logout", func() {
|
|||||||
defer registriesConf.Close()
|
defer registriesConf.Close()
|
||||||
defer os.Remove(registriesConf.Name())
|
defer os.Remove(registriesConf.Name())
|
||||||
|
|
||||||
err = ioutil.WriteFile(registriesConf.Name(), []byte(registriesConfWithSearch), os.ModePerm)
|
err = ioutil.WriteFile(registriesConf.Name(), registriesConfWithSearch, os.ModePerm)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
|
|
||||||
// Environment is per-process, so this looks very unsafe; actually it seems fine because tests are not
|
// Environment is per-process, so this looks very unsafe; actually it seems fine because tests are not
|
||||||
|
@ -475,7 +475,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
interval := time.Duration(250 * time.Millisecond)
|
interval := 250 * time.Millisecond
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
n := podmanTest.Podman([]string{"network", "exists", netName})
|
n := podmanTest.Podman([]string{"network", "exists", netName})
|
||||||
n.WaitWithDefaultTimeout()
|
n.WaitWithDefaultTimeout()
|
||||||
@ -490,7 +490,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
|
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
|
||||||
top.WaitWithDefaultTimeout()
|
top.WaitWithDefaultTimeout()
|
||||||
Expect(top).Should(Exit(0))
|
Expect(top).Should(Exit(0))
|
||||||
interval = time.Duration(250 * time.Millisecond)
|
interval = 250 * time.Millisecond
|
||||||
// Wait for the nginx service to be running
|
// Wait for the nginx service to be running
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
// Test curl against the container's name
|
// Test curl against the container's name
|
||||||
@ -526,7 +526,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
defer podmanTest.removeNetwork(netName)
|
defer podmanTest.removeNetwork(netName)
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
interval := time.Duration(250 * time.Millisecond)
|
interval := 250 * time.Millisecond
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
n := podmanTest.Podman([]string{"network", "exists", netName})
|
n := podmanTest.Podman([]string{"network", "exists", netName})
|
||||||
n.WaitWithDefaultTimeout()
|
n.WaitWithDefaultTimeout()
|
||||||
@ -541,7 +541,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
|
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
|
||||||
top.WaitWithDefaultTimeout()
|
top.WaitWithDefaultTimeout()
|
||||||
Expect(top).Should(Exit(0))
|
Expect(top).Should(Exit(0))
|
||||||
interval = time.Duration(250 * time.Millisecond)
|
interval = 250 * time.Millisecond
|
||||||
// Wait for the nginx service to be running
|
// Wait for the nginx service to be running
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
// Test curl against the container's name
|
// Test curl against the container's name
|
||||||
|
@ -731,7 +731,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||||||
linkAttr.Name = name
|
linkAttr.Name = name
|
||||||
m, err := net.ParseMAC(mac)
|
m, err := net.ParseMAC(mac)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
linkAttr.HardwareAddr = net.HardwareAddr(m)
|
linkAttr.HardwareAddr = m
|
||||||
eth := &netlink.Dummy{LinkAttrs: linkAttr}
|
eth := &netlink.Dummy{LinkAttrs: linkAttr}
|
||||||
err = netlink.LinkAdd(eth)
|
err = netlink.LinkAdd(eth)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
|
@ -66,7 +66,7 @@ var _ = Describe("podman system df", func() {
|
|||||||
images := strings.Fields(session.OutputToStringArray()[1])
|
images := strings.Fields(session.OutputToStringArray()[1])
|
||||||
containers := strings.Fields(session.OutputToStringArray()[2])
|
containers := strings.Fields(session.OutputToStringArray()[2])
|
||||||
volumes := strings.Fields(session.OutputToStringArray()[3])
|
volumes := strings.Fields(session.OutputToStringArray()[3])
|
||||||
Expect(images[1]).To(Equal(string(totImages)), "total images expected")
|
Expect(images[1]).To(Equal(totImages), "total images expected")
|
||||||
Expect(containers[1]).To(Equal("2"), "total containers expected")
|
Expect(containers[1]).To(Equal("2"), "total containers expected")
|
||||||
Expect(volumes[2]).To(Equal("2"), "total volumes expected")
|
Expect(volumes[2]).To(Equal("2"), "total volumes expected")
|
||||||
Expect(volumes[6]).To(Equal("(50%)"), "percentage usage expected")
|
Expect(volumes[6]).To(Equal("(50%)"), "percentage usage expected")
|
||||||
|
@ -192,7 +192,7 @@ func moveProcessPIDFileToScope(pidPath, slice, scope string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func moveProcessToScope(pid int, slice, scope string) error {
|
func moveProcessToScope(pid int, slice, scope string) error {
|
||||||
err := RunUnderSystemdScope(int(pid), slice, scope)
|
err := RunUnderSystemdScope(pid, slice, scope)
|
||||||
// If the PID is not valid anymore, do not return an error.
|
// If the PID is not valid anymore, do not return an error.
|
||||||
if dbusErr, ok := err.(dbus.Error); ok {
|
if dbusErr, ok := err.(dbus.Error); ok {
|
||||||
if dbusErr.Name == "org.freedesktop.DBus.Error.UnixProcessIdUnknown" {
|
if dbusErr.Name == "org.freedesktop.DBus.Error.UnixProcessIdUnknown" {
|
||||||
|
Reference in New Issue
Block a user