selinux: drop superflous relabel

The same relabel is already done in writeStringToRundir so we don't
need to do it twice.  The version in writeStringToRundir takes into
account the correct file path when using user namespaces.

Closes: https://github.com/containers/libpod/pull/1584

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2018-10-03 16:49:42 +02:00
parent 230edff521
commit 7abf46d15e
No known key found for this signature in database
GPG key ID: E4730F97F60286ED

View file

@ -939,9 +939,6 @@ func (c *Container) makeBindMounts() error {
if err != nil {
return errors.Wrapf(err, "error creating resolv.conf for container %s", c.ID())
}
if err = label.Relabel(newResolv, c.config.MountLabel, false); err != nil {
return errors.Wrapf(err, "error relabeling %q for container %q", newResolv, c.ID())
}
c.state.BindMounts["/etc/resolv.conf"] = newResolv
// Make /etc/hosts
@ -953,9 +950,6 @@ func (c *Container) makeBindMounts() error {
if err != nil {
return errors.Wrapf(err, "error creating hosts file for container %s", c.ID())
}
if err = label.Relabel(newHosts, c.config.MountLabel, false); err != nil {
return errors.Wrapf(err, "error relabeling %q for container %q", newHosts, c.ID())
}
c.state.BindMounts["/etc/hosts"] = newHosts
// Make /etc/hostname
@ -965,9 +959,6 @@ func (c *Container) makeBindMounts() error {
if err != nil {
return errors.Wrapf(err, "error creating hostname file for container %s", c.ID())
}
if err = label.Relabel(hostnamePath, c.config.MountLabel, false); err != nil {
return errors.Wrapf(err, "error relabeling %q for container %q", hostnamePath, c.ID())
}
c.state.BindMounts["/etc/hostname"] = hostnamePath
}