summaryrefslogtreecommitdiff
path: root/pkg/rootlessport
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-03-23 15:25:09 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-03-24 13:56:20 +0100
commit720f0bc562cc2c073471dede21d2076040f13071 (patch)
tree76ba19079ae1be4d554add86e2234da1b32416dc /pkg/rootlessport
parent3dbf2cb5aff67f82e486cd95aca170e44b8fc75a (diff)
downloadpodman-720f0bc562cc2c073471dede21d2076040f13071.tar.gz
podman-720f0bc562cc2c073471dede21d2076040f13071.tar.bz2
podman-720f0bc562cc2c073471dede21d2076040f13071.zip
rootlessport: use x/sys/unix instead of syscall
Dup2 is not defined on arm64 in the syscall package. Closes: https://github.com/containers/libpod/issues/5587 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/rootlessport')
-rw-r--r--pkg/rootlessport/rootlessport_linux.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go
index 6ecd3cf98..1c1ed39df 100644
--- a/pkg/rootlessport/rootlessport_linux.go
+++ b/pkg/rootlessport/rootlessport_linux.go
@@ -20,7 +20,6 @@ import (
"os"
"os/exec"
"os/signal"
- "syscall"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/storage/pkg/reexec"
@@ -30,6 +29,7 @@ import (
rkbuiltin "github.com/rootless-containers/rootlesskit/pkg/port/builtin"
rkportutil "github.com/rootless-containers/rootlesskit/pkg/port/portutil"
"github.com/sirupsen/logrus"
+ "golang.org/x/sys/unix"
)
const (
@@ -103,10 +103,10 @@ func parent() error {
}
sigC := make(chan os.Signal, 1)
- signal.Notify(sigC, syscall.SIGPIPE)
+ signal.Notify(sigC, unix.SIGPIPE)
defer func() {
// dummy signal to terminate the goroutine
- sigC <- syscall.SIGKILL
+ sigC <- unix.SIGKILL
}()
go func() {
defer func() {
@@ -115,10 +115,10 @@ func parent() error {
}()
s := <-sigC
- if s == syscall.SIGPIPE {
+ if s == unix.SIGPIPE {
if f, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755); err == nil {
- syscall.Dup2(int(f.Fd()), 1) // nolint:errcheck
- syscall.Dup2(int(f.Fd()), 2) // nolint:errcheck
+ unix.Dup2(int(f.Fd()), 1) // nolint:errcheck
+ unix.Dup2(int(f.Fd()), 2) // nolint:errcheck
f.Close()
}
}
@@ -191,7 +191,7 @@ func parent() error {
}()
defer func() {
- if err := syscall.Kill(cmd.Process.Pid, syscall.SIGTERM); err != nil {
+ if err := unix.Kill(cmd.Process.Pid, unix.SIGTERM); err != nil {
logrus.WithError(err).Warn("kill child process")
}
}()