summaryrefslogtreecommitdiff
path: root/libpod/container_internal_common.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container_internal_common.go')
-rw-r--r--libpod/container_internal_common.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go
index 9c4a3bb67..29107d4b6 100644
--- a/libpod/container_internal_common.go
+++ b/libpod/container_internal_common.go
@@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"math"
"os"
"os/user"
@@ -110,7 +109,11 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
// If the flag to mount all devices is set for a privileged container, add
// all the devices from the host's machine into the container
if c.config.MountAllDevices {
- if err := util.AddPrivilegedDevices(&g); err != nil {
+ systemdMode := false
+ if c.config.Systemd != nil {
+ systemdMode = *c.config.Systemd
+ }
+ if err := util.AddPrivilegedDevices(&g, systemdMode); err != nil {
return nil, err
}
}
@@ -788,7 +791,7 @@ func (c *Container) createCheckpointImage(ctx context.Context, options Container
}
// Export checkpoint into temporary tar file
- tmpDir, err := ioutil.TempDir("", "checkpoint_image_")
+ tmpDir, err := os.MkdirTemp("", "checkpoint_image_")
if err != nil {
return err
}
@@ -2442,7 +2445,7 @@ func (c *Container) generatePasswdAndGroup() (string, string, error) {
if err != nil {
return "", "", fmt.Errorf("creating path to container %s /etc/passwd: %w", c.ID(), err)
}
- orig, err := ioutil.ReadFile(originPasswdFile)
+ orig, err := os.ReadFile(originPasswdFile)
if err != nil && !os.IsNotExist(err) {
return "", "", err
}
@@ -2488,7 +2491,7 @@ func (c *Container) generatePasswdAndGroup() (string, string, error) {
if err != nil {
return "", "", fmt.Errorf("creating path to container %s /etc/group: %w", c.ID(), err)
}
- orig, err := ioutil.ReadFile(originGroupFile)
+ orig, err := os.ReadFile(originGroupFile)
if err != nil && !os.IsNotExist(err) {
return "", "", err
}
@@ -2659,7 +2662,7 @@ func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
return nil
}
-func (c *Container) relabel(src, mountLabel string, recurse bool) error {
+func (c *Container) relabel(src, mountLabel string, shared bool) error {
if !selinux.GetEnabled() || mountLabel == "" {
return nil
}
@@ -2674,7 +2677,7 @@ func (c *Container) relabel(src, mountLabel string, recurse bool) error {
return nil
}
}
- return label.Relabel(src, mountLabel, recurse)
+ return label.Relabel(src, mountLabel, shared)
}
func (c *Container) ChangeHostPathOwnership(src string, recurse bool, uid, gid int) error {