Merge pull request #40945 from thaJeztah/fix_selinux_enotsup

SELinux: fix ENOTSUP errors not being detected when relabeling
This commit is contained in:
Brian Goff 2020-05-11 08:24:16 -07:00 committed by GitHub
commit a93e9eb0e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -20,7 +20,6 @@ import (
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
const (
@ -147,7 +146,7 @@ func (container *Container) CopyImagePathContent(v volume.Volume, destination st
logrus.Warnf("error while unmounting volume %s: %v", v.Name(), err)
}
}()
if err := label.Relabel(path, container.MountLabel, true); err != nil && err != unix.ENOTSUP {
if err := label.Relabel(path, container.MountLabel, true); err != nil && !errors.Is(err, syscall.ENOTSUP) {
return err
}
return copyExistingContents(rootfs, path)

View file

@ -113,7 +113,7 @@ func (m *MountPoint) Setup(mountLabel string, rootIDs idtools.Identity, checkFun
return
}
err = label.Relabel(sourcePath, mountLabel, label.IsShared(m.Mode))
if err == syscall.ENOTSUP {
if errors.Is(err, syscall.ENOTSUP) {
err = nil
}
if err != nil {