git://git.halfball.org
/
plugins.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
98cafb1
)
pkg/ns: use unix.Setns() instead of open coding it
author
Tobias Klauser
<tklauser@distanz.ch>
Thu, 8 Jun 2017 12:48:58 +0000
(14:48 +0200)
committer
Tobias Klauser
<tklauser@distanz.ch>
Thu, 8 Jun 2017 12:48:58 +0000
(14:48 +0200)
Use unix.Setns() instead of manually re-implementing it using
unix.Syscall().
pkg/ns/ns_linux.go
patch
|
blob
|
history
diff --git
a/pkg/ns/ns_linux.go
b/pkg/ns/ns_linux.go
index
c9e1b4f
..
8949d21
100644
(file)
--- a/
pkg/ns/ns_linux.go
+++ b/
pkg/ns/ns_linux.go
@@
-141,7
+141,7
@@
func (ns *netNS) Set() error {
return err
}
- if
_, _, err := unix.Syscall(unix.SYS_SETNS, ns.Fd(), uintptr(unix.CLONE_NEWNET), 0); err != 0
{
+ if
err := unix.Setns(int(ns.Fd()), unix.CLONE_NEWNET); err != nil
{
return fmt.Errorf("Error switching to ns %v: %v", ns.file.Name(), err)
}