소스 검색

Make kernel detection work without suffix

Guillaume J. Charmes 12 년 전
부모
커밋
c05c91ca3b
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      getKernelVersion_darwin.go
  2. 4 0
      getKernelVersion_linux.go

+ 4 - 0
getKernelVersion_darwin.go

@@ -1,5 +1,9 @@
 package docker
 package docker
 
 
+import (
+	"fmt"
+)
+
 func getKernelVersion() (*KernelVersionInfo, error) {
 func getKernelVersion() (*KernelVersionInfo, error) {
 	return nil, fmt.Errorf("Kernel version detection is not available on darwin")
 	return nil, fmt.Errorf("Kernel version detection is not available on darwin")
 }
 }

+ 4 - 0
getKernelVersion_linux.go

@@ -1,6 +1,7 @@
 package docker
 package docker
 
 
 import (
 import (
+	"bytes"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"syscall"
 	"syscall"
@@ -26,6 +27,9 @@ func getKernelVersion() (*KernelVersionInfo, error) {
 		i++
 		i++
 	}
 	}
 
 
+	// Remove the \x00 from the release for Atoi to parse correctly
+	release = release[:bytes.IndexByte(release, 0)]
+
 	tmp := strings.SplitN(string(release), "-", 2)
 	tmp := strings.SplitN(string(release), "-", 2)
 	tmp2 := strings.SplitN(tmp[0], ".", 3)
 	tmp2 := strings.SplitN(tmp[0], ".", 3)