From 73a1ef7c22f5cde9db5e1292f1340885bf28e807 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 18 Dec 2013 10:16:26 -0800 Subject: [PATCH] Fix OSX build for sysinit --- sysinit/sysinit.go | 2 +- sysinit/sysinit_darwin.go | 5 +++++ sysinit/sysinit_linux.go | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 sysinit/sysinit_darwin.go create mode 100644 sysinit/sysinit_linux.go diff --git a/sysinit/sysinit.go b/sysinit/sysinit.go index 2dc5967dc6..ad97439450 100644 --- a/sysinit/sysinit.go +++ b/sysinit/sysinit.go @@ -32,7 +32,7 @@ func setupHostname(args *DockerInitArgs) error { if hostname == "" { return nil } - return syscall.Sethostname([]byte(hostname)) + return setHostname(hostname) } // Setup networking diff --git a/sysinit/sysinit_darwin.go b/sysinit/sysinit_darwin.go new file mode 100644 index 0000000000..64566afb3c --- /dev/null +++ b/sysinit/sysinit_darwin.go @@ -0,0 +1,5 @@ +package sysinit + +func setHostname(hostname string) error { + panic("Not supported on darwin") +} diff --git a/sysinit/sysinit_linux.go b/sysinit/sysinit_linux.go new file mode 100644 index 0000000000..d18d2fab8b --- /dev/null +++ b/sysinit/sysinit_linux.go @@ -0,0 +1,9 @@ +package sysinit + +import ( + "syscall" +) + +func setHostname(hostname string) error { + return syscall.Sethostname([]byte(hostname)) +}