Browse Source

Fix OSX build for sysinit

Guillaume J. Charmes 11 years ago
parent
commit
73a1ef7c22
3 changed files with 15 additions and 1 deletions
  1. 1 1
      sysinit/sysinit.go
  2. 5 0
      sysinit/sysinit_darwin.go
  3. 9 0
      sysinit/sysinit_linux.go

+ 1 - 1
sysinit/sysinit.go

@@ -32,7 +32,7 @@ func setupHostname(args *DockerInitArgs) error {
 	if hostname == "" {
 	if hostname == "" {
 		return nil
 		return nil
 	}
 	}
-	return syscall.Sethostname([]byte(hostname))
+	return setHostname(hostname)
 }
 }
 
 
 // Setup networking
 // Setup networking

+ 5 - 0
sysinit/sysinit_darwin.go

@@ -0,0 +1,5 @@
+package sysinit
+
+func setHostname(hostname string) error {
+	panic("Not supported on darwin")
+}

+ 9 - 0
sysinit/sysinit_linux.go

@@ -0,0 +1,9 @@
+package sysinit
+
+import (
+	"syscall"
+)
+
+func setHostname(hostname string) error {
+	return syscall.Sethostname([]byte(hostname))
+}