Partial refactor of UID/GID usage to use a unified struct.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2017-05-19 18:06:46 -04:00
parent d2a83863ed
commit 09cd96c5ad
28 changed files with 180 additions and 141 deletions

View File

@@ -54,8 +54,8 @@ func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, er
return nil
}
rootUID, rootGID := daemon.GetRemappedUIDGID()
path, err := m.Setup(c.MountLabel, rootUID, rootGID, checkfunc)
rootIDs, _ := daemon.idMappings.RootPair()
path, err := m.Setup(c.MountLabel, rootIDs, checkfunc)
if err != nil {
return nil, err
}
@@ -85,9 +85,9 @@ func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, er
// if we are going to mount any of the network files from container
// metadata, the ownership must be set properly for potential container
// remapped root (user namespaces)
rootUID, rootGID := daemon.GetRemappedUIDGID()
rootIDs, _ := daemon.idMappings.RootPair()
for _, mount := range netMounts {
if err := os.Chown(mount.Source, rootUID, rootGID); err != nil {
if err := os.Chown(mount.Source, rootIDs.UID, rootIDs.GID); err != nil {
return nil, err
}
}