aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/syscall/exec_bsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/syscall/exec_bsd.go')
-rw-r--r--libgo/go/syscall/exec_bsd.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go
index a241e21..3a4db04 100644
--- a/libgo/go/syscall/exec_bsd.go
+++ b/libgo/go/syscall/exec_bsd.go
@@ -168,6 +168,26 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Detach fd 0 from tty
+ if sys.Noctty {
+ _, err1 = raw_ioctl(0, TIOCNOTTY, 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
+ // Set the controlling TTY to Ctty
+ if sys.Setctty {
+ if TIOCSCTTY == 0 {
+ err1 = ENOSYS
+ goto childerror
+ }
+ _, err1 = raw_ioctl(sys.Ctty, TIOCSCTTY, 0)
+ if err1 != 0 {
+ goto childerror
+ }
+ }
+
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
if pipe < nextfd {
@@ -225,26 +245,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
raw_close(i)
}
- // Detach fd 0 from tty
- if sys.Noctty {
- _, err1 = raw_ioctl(0, TIOCNOTTY, 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
- // Set the controlling TTY to Ctty
- if sys.Setctty {
- if TIOCSCTTY == 0 {
- err1 = ENOSYS
- goto childerror
- }
- _, err1 = raw_ioctl(sys.Ctty, TIOCSCTTY, 0)
- if err1 != 0 {
- goto childerror
- }
- }
-
// Time to exec.
err1 = raw_execve(argv0, &argv[0], &envv[0])