summaryrefslogtreecommitdiff
path: root/extra/sbcl/0001-Fix-version-string-parsing-for-Linux-3.0.patch
blob: fe5a807eea40ec095e4f59c5886e9af568788ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From b43c51beeb0569a38900e1e5a78606711f987742 Mon Sep 17 00:00:00 2001
From: Paul Khuong <pvk@pvk.ca>
Date: Wed, 3 Aug 2011 10:20:41 -0400
Subject: [PATCH] Fix version string parsing for Linux 3.0

 Stop assuming the presence of minor and patch version numbers; missing
 values are defaulted to 0 (e.g. 3.0.0).

 Reported by a few people on IRC.
---
 src/runtime/linux-os.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/runtime/linux-os.c b/src/runtime/linux-os.c
index db72fa6..e262f41 100644
--- a/src/runtime/linux-os.c
+++ b/src/runtime/linux-os.c
@@ -198,12 +198,18 @@ os_init(char *argv[], char *envp[])
     int patch_version;
     char *p;
     uname(&name);
+
     p=name.release;
     major_version = atoi(p);
-    p=strchr(p,'.')+1;
-    minor_version = atoi(p);
-    p=strchr(p,'.')+1;
-    patch_version = atoi(p);
+    minor_version = patch_version = 0;
+    p=strchr(p,'.');
+    if (p != NULL) {
+            minor_version = atoi(++p);
+            p=strchr(p,'.');
+            if (p != NULL)
+                    patch_version = atoi(++p);
+    }
+
     if (major_version<2) {
         lose("linux kernel version too old: major version=%d (can't run in version < 2.0.0)\n",
              major_version);
-- 
1.7.6