mirror of
https://github.com/opencontainers/runc.git
synced 2025-12-24 11:50:58 +08:00
libct: simplify Caps inheritance
For all other properties that are available in both Config and Process, the merging is performed by newInitConfig. Let's do the same for Capabilities for the sake of code uniformity. Also, thanks to the previous commit, we no longer have to make sure we do not call capabilities.New(nil). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -700,7 +700,7 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
|
||||
GID: process.GID,
|
||||
AdditionalGroups: process.AdditionalGroups,
|
||||
Cwd: process.Cwd,
|
||||
Capabilities: process.Capabilities,
|
||||
Capabilities: c.config.Capabilities,
|
||||
PassedFilesCount: len(process.ExtraFiles),
|
||||
ContainerID: c.ID(),
|
||||
NoNewPrivileges: c.config.NoNewPrivileges,
|
||||
@@ -714,6 +714,9 @@ func (c *Container) newInitConfig(process *Process) *initConfig {
|
||||
|
||||
// Overwrite config properties with ones from process.
|
||||
|
||||
if process.Capabilities != nil {
|
||||
cfg.Capabilities = process.Capabilities
|
||||
}
|
||||
if process.NoNewPrivileges != nil {
|
||||
cfg.NoNewPrivileges = *process.NoNewPrivileges
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user