Skip to content

Commit 3d10773

Browse files
committed
fix exec_other signature, fix syscall return vlaues
Signed-off-by: leongross <[email protected]>
1 parent cb2f4c3 commit 3d10773

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/os/exec_other.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
77
return 0, ErrNotImplemented
88
}
99

10-
func startProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) {
11-
return 0, 0, ErrNotImplemented
10+
func startProcess(argv0 string, argv []string, attr *ProcAttr) (proc *Process, err error) {
11+
return &Process{Pid: 0}, ErrNotImplemented
1212
}

src/os/exec_posix.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,17 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
7575
argvp[0] = argv0p
7676
}
7777

78-
ret, _, _ = syscall.Fork()
78+
pid = syscall.Fork()
79+
if ret < 0 {
80+
return 0, errors.New("fork failed")
81+
}
82+
7983
if ret != 0 {
8084
// if fd == 0 code runs in parent
8185
return int(ret), nil
8286
} else {
8387
// else code runs in child, which then should exec the new process
84-
ret, _, _ = syscall.Execve(argv0, argv, envp)
88+
ret = syscall.Execve(argv0, argv, envp)
8589
if ret != 0 {
8690
// exec failed
8791
syscall.Exit(1)

0 commit comments

Comments
 (0)