mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
This PR reflects the upstream change of moving the buildah module from github.com/containers/buildah to go.podman.io/buildah. Signed-off-by: Brent Baude <bbaude@redhat.com>
22 lines
603 B
Go
22 lines
603 B
Go
//go:build linux
|
|
|
|
package chroot
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/opencontainers/runtime-spec/specs-go"
|
|
selinux "github.com/opencontainers/selinux/go-selinux"
|
|
"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 := selinux.SetExecLabel(spec.Process.SelinuxLabel); err != nil {
|
|
return fmt.Errorf("setting process label to %q: %w", spec.Process.SelinuxLabel, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|