mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 03:46:19 +08:00
utils_linux: simplify newProcess
newProcess do not need those extra arguments, they can be handled in the caller. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -97,7 +97,7 @@ func getDefaultImagePath(context *cli.Context) string {
|
||||
|
||||
// newProcess returns a new libcontainer Process with the arguments from the
|
||||
// spec and stdio from the current process.
|
||||
func newProcess(p specs.Process, init bool, logLevel string) (*libcontainer.Process, error) {
|
||||
func newProcess(p specs.Process) (*libcontainer.Process, error) {
|
||||
lp := &libcontainer.Process{
|
||||
Args: p.Args,
|
||||
Env: p.Env,
|
||||
@@ -107,8 +107,6 @@ func newProcess(p specs.Process, init bool, logLevel string) (*libcontainer.Proc
|
||||
Label: p.SelinuxLabel,
|
||||
NoNewPrivileges: &p.NoNewPrivileges,
|
||||
AppArmorProfile: p.ApparmorProfile,
|
||||
Init: init,
|
||||
LogLevel: logLevel,
|
||||
}
|
||||
|
||||
if p.ConsoleSize != nil {
|
||||
@@ -270,10 +268,13 @@ func (r *runner) run(config *specs.Process) (int, error) {
|
||||
if err = r.checkTerminal(config); err != nil {
|
||||
return -1, err
|
||||
}
|
||||
process, err := newProcess(*config, r.init, r.logLevel)
|
||||
process, err := newProcess(*config)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
// Populate the fields that come from runner.
|
||||
process.Init = r.init
|
||||
process.LogLevel = r.logLevel
|
||||
if len(r.listenFDs) > 0 {
|
||||
process.Env = append(process.Env, "LISTEN_FDS="+strconv.Itoa(len(r.listenFDs)), "LISTEN_PID=1")
|
||||
process.ExtraFiles = append(process.ExtraFiles, r.listenFDs...)
|
||||
|
Reference in New Issue
Block a user