Ensure resolv.conf has the right label and path

Adds a few missing things from writeStringToRundir() to the new
resolv.conf function, specifically relabelling and returning a
path compatible with rootless podman

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
This commit is contained in:
Matthew Heon
2018-10-04 17:38:09 -04:00
parent ae5af67d61
commit e9ab8583d0
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,5 @@
// +build seccomp ostree selinux varlink exclude_graphdriver_devicemapper
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package libpod package libpod

View File

@ -1068,7 +1068,12 @@ func (c *Container) generateResolvConf() (string, error) {
return "", errors.Wrapf(err, "error building resolv.conf for container %s") return "", errors.Wrapf(err, "error building resolv.conf for container %s")
} }
return destPath, nil // Relabel resolv.conf for the container
if err := label.Relabel(destPath, c.config.MountLabel, false); err != nil {
return "", err
}
return filepath.Join(c.state.DestinationRunDir, "resolv.conf"), nil
} }
// generateHosts creates a containers hosts file // generateHosts creates a containers hosts file