mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 11:53:40 +08:00
Fixups for newProcess
1. Pass an argument as a pointer rather than copying the whole structure. It was a pointer initially, but this has changed in commitb2d9d996
without giving a reason why. 2. The newProcess description was added by commit9fac18329
(yes, the very first one) and hasn't changed since. As of commit29b139f7
, the part of it which says "and stdio from the current process" is no longer valid. Remove it, and while at it, rewrite the description entirely. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -43,9 +43,8 @@ func getDefaultImagePath() string {
|
|||||||
return filepath.Join(cwd, "checkpoint")
|
return filepath.Join(cwd, "checkpoint")
|
||||||
}
|
}
|
||||||
|
|
||||||
// newProcess returns a new libcontainer Process with the arguments from the
|
// newProcess converts [specs.Process] to [libcontainer.Process].
|
||||||
// spec and stdio from the current process.
|
func newProcess(p *specs.Process) (*libcontainer.Process, error) {
|
||||||
func newProcess(p specs.Process) (*libcontainer.Process, error) {
|
|
||||||
lp := &libcontainer.Process{
|
lp := &libcontainer.Process{
|
||||||
Args: p.Args,
|
Args: p.Args,
|
||||||
Env: p.Env,
|
Env: p.Env,
|
||||||
@@ -221,7 +220,7 @@ func (r *runner) run(config *specs.Process) (int, error) {
|
|||||||
if err = r.checkTerminal(config); err != nil {
|
if err = r.checkTerminal(config); err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
process, err := newProcess(*config)
|
process, err := newProcess(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user