mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-27 02:37:53 +00:00
Systemd is now complaining or mentioning /var/run as a legacy directory. It has been many years where /var/run is a symlink to /run on all most distributions, make the change to the default. Partial fix for https://github.com/containers/podman/issues/8369 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
22 lines
678 B
Go
22 lines
678 B
Go
// +build linux
|
|
|
|
package chroot
|
|
|
|
import (
|
|
"github.com/opencontainers/runtime-spec/specs-go"
|
|
selinux "github.com/opencontainers/selinux/go-selinux"
|
|
"github.com/opencontainers/selinux/go-selinux/label"
|
|
"github.com/pkg/errors"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// setSelinuxLabel sets the process label for child processes that we'll start.
|
|
func setSelinuxLabel(spec *specs.Spec) error {
|
|
logrus.Debugf("setting selinux label")
|
|
if spec.Process.SelinuxLabel != "" && selinux.GetEnabled() {
|
|
if err := label.SetProcessLabel(spec.Process.SelinuxLabel); err != nil {
|
|
return errors.Wrapf(err, "error setting process label to %q", spec.Process.SelinuxLabel)
|
|
}
|
|
}
|
|
return nil
|
|
}
|