From 60f22426d52ac3e2b746619bd57298813c4822dc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 19 Dec 2016 02:00:24 -0500 Subject: Use x/sys/unix instead of the deprecated syscall. BREAKING CHANGE. This is just a search/replace s/syscall/unix/g in the broken code. --- nslcd_proto/io.go | 11 ++++++----- nslcd_server/func_handlerequest.go.gen | 6 +++--- nslcd_server/interface_backend.go.gen | 7 +++---- nslcd_server/type_nilbackend.go.gen | 5 ++--- nslcd_systemd/nslcd_systemd.go | 12 ++++++------ 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/nslcd_proto/io.go b/nslcd_proto/io.go index fa40be3..9252aca 100644 --- a/nslcd_proto/io.go +++ b/nslcd_proto/io.go @@ -23,7 +23,8 @@ import ( "io" "net" "reflect" - "syscall" + + "golang.org/x/sys/unix" ) type NslcdError string @@ -72,9 +73,9 @@ func Write(fd io.Writer, data interface{}) { var af int32 = -1 switch len(data) { case net.IPv4len: - af = syscall.AF_INET + af = unix.AF_INET case net.IPv6len: - af = syscall.AF_INET6 + af = unix.AF_INET6 } var bytes []byte if af < 0 { @@ -141,9 +142,9 @@ func Read(fd io.Reader, data interface{}) { Read(fd, &af) var _len int32 switch af { - case syscall.AF_INET: + case unix.AF_INET: _len = net.IPv4len - case syscall.AF_INET6: + case unix.AF_INET6: _len = net.IPv6len default: panic(NslcdError(fmt.Sprintf("incorrect address family specified: %d", af))) diff --git a/nslcd_server/func_handlerequest.go.gen b/nslcd_server/func_handlerequest.go.gen index 4c58ae0..bef29c0 100755 --- a/nslcd_server/func_handlerequest.go.gen +++ b/nslcd_server/func_handlerequest.go.gen @@ -28,15 +28,15 @@ import ( "fmt" "io" "os" - s "syscall" + "golang.org/x/sys/unix" p "lukeshu.com/git/go/libnslcd.git/nslcd_proto" ) var sensitive = "" // Handle a request to nslcd -func HandleRequest(backend Backend, in io.Reader, out io.Writer, cred s.Ucred) (err error) { +func HandleRequest(backend Backend, in io.Reader, out io.Writer, cred unix.Ucred) (err error) { err = nil defer func() { if r := recover(); r != nil { @@ -52,7 +52,7 @@ func HandleRequest(backend Backend, in io.Reader, out io.Writer, cred s.Ucred) ( return } -func handleRequest(backend Backend, in io.Reader, out io.Writer, cred s.Ucred) { +func handleRequest(backend Backend, in io.Reader, out io.Writer, cred unix.Ucred) { var version int32 p.Read(in, &version) if version != p.NSLCD_VERSION { diff --git a/nslcd_server/interface_backend.go.gen b/nslcd_server/interface_backend.go.gen index 94a0433..bca8e17 100755 --- a/nslcd_server/interface_backend.go.gen +++ b/nslcd_server/interface_backend.go.gen @@ -24,8 +24,7 @@ cat <