Browse code

Make kernel detection work without suffix

Guillaume J. Charmes authored on 2013/04/23 05:19:50
Showing 2 changed files
... ...
@@ -1,5 +1,9 @@
1 1
 package docker
2 2
 
3
+import (
4
+	"fmt"
5
+)
6
+
3 7
 func getKernelVersion() (*KernelVersionInfo, error) {
4 8
 	return nil, fmt.Errorf("Kernel version detection is not available on darwin")
5 9
 }
... ...
@@ -1,6 +1,7 @@
1 1
 package docker
2 2
 
3 3
 import (
4
+	"bytes"
4 5
 	"strconv"
5 6
 	"strings"
6 7
 	"syscall"
... ...
@@ -26,6 +27,9 @@ func getKernelVersion() (*KernelVersionInfo, error) {
26 26
 		i++
27 27
 	}
28 28
 
29
+	// Remove the \x00 from the release for Atoi to parse correctly
30
+	release = release[:bytes.IndexByte(release, 0)]
31
+
29 32
 	tmp := strings.SplitN(string(release), "-", 2)
30 33
 	tmp2 := strings.SplitN(tmp[0], ".", 3)
31 34