Skip to content

Commit 4b87c7d

Browse files
committed
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 commit b2d9d99 without giving a reason why. 2. The newProcess description was added by commit 9fac183 (yes, the very first one) and hasn't changed since. As of commit 29b139f, 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 <[email protected]>
1 parent 8fbdb7e commit 4b87c7d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

utils_linux.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ func getDefaultImagePath() string {
4343
return filepath.Join(cwd, "checkpoint")
4444
}
4545

46-
// newProcess returns a new libcontainer Process with the arguments from the
47-
// spec and stdio from the current process.
48-
func newProcess(p specs.Process) (*libcontainer.Process, error) {
46+
// newProcess converts [specs.Process] to [libcontainer.Process].
47+
func newProcess(p *specs.Process) (*libcontainer.Process, error) {
4948
lp := &libcontainer.Process{
5049
Args: p.Args,
5150
Env: p.Env,
@@ -221,7 +220,7 @@ func (r *runner) run(config *specs.Process) (int, error) {
221220
if err = r.checkTerminal(config); err != nil {
222221
return -1, err
223222
}
224-
process, err := newProcess(*config)
223+
process, err := newProcess(config)
225224
if err != nil {
226225
return -1, err
227226
}

0 commit comments

Comments
 (0)