Skip to content

Commit

Permalink
Fix build for linux_arm64 (#29)
Browse files Browse the repository at this point in the history
linux_arm64 platform doesn't have syscall.Dup2
so use the nearly identical syscall.Dup3 instead.
  • Loading branch information
sevlyar committed Nov 24, 2017
1 parent 298c54b commit 2f19e76
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion daemon_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (d *Context) child() (err error) {
d.pidFile.Remove()
return
}
if err = syscall.Dup2(3, 0); err != nil {
if err = syscallDup(3, 0); err != nil {
d.pidFile.Remove()
return
}
Expand Down
12 changes: 12 additions & 0 deletions syscall_dup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build !linux !arm64
// +build !windows

package daemon

import (
"syscall"
)

func syscallDup(oldfd int, newfd int) (err error) {
return syscall.Dup2(oldfd, newfd)
}
11 changes: 11 additions & 0 deletions syscall_dup_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build linux,arm64

package daemon

import "syscall"

func syscallDup(oldfd int, newfd int) (err error) {
// linux_arm64 platform doesn't have syscall.Dup2
// so use the nearly identical syscall.Dup3 instead.
return syscall.Dup3(oldfd, newfd, 0)
}

0 comments on commit 2f19e76

Please sign in to comment.