1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/2.7/250-sh-chop-linux-version.patch Wed Dec 07 16:15:50 2011 +0800
1.3 @@ -0,0 +1,49 @@
1.4 +--- glibc-2.7/sysdeps/unix/sysv/linux/dl-osinfo.h.orig 2007-09-15 23:54:08.000000000 +0100
1.5 ++++ glibc-2.7/sysdeps/unix/sysv/linux/dl-osinfo.h 2008-08-20 09:26:26.000000000 +0100
1.6 +@@ -83,6 +83,10 @@
1.7 + int parts;
1.8 + char *cp;
1.9 + struct utsname uts;
1.10 ++ int dotsfound = 0;
1.11 ++ int versionindex = 0;
1.12 ++ char *choppoint;
1.13 ++
1.14 +
1.15 + /* Try the uname system call. */
1.16 + if (__uname (&uts))
1.17 +@@ -102,8 +106,34 @@
1.18 + else
1.19 + buf = uts.release;
1.20 +
1.21 ++ /* We are only interested in the first three kernel numbers, so */
1.22 ++ /* chop off anything past that: */
1.23 ++
1.24 ++ choppoint = buf;
1.25 ++ while (1)
1.26 ++ {
1.27 ++ versionindex++;
1.28 ++ if (versionindex == 63) break;
1.29 ++ if (*choppoint == '.') dotsfound++;
1.30 ++ choppoint++;
1.31 ++ if (dotsfound == 2)
1.32 ++ {
1.33 ++ if (*choppoint == '0' || *choppoint == '1'
1.34 ++ || *choppoint == '2' || *choppoint == '3'
1.35 ++ || *choppoint == '4' || *choppoint == '5'
1.36 ++ || *choppoint == '6' || *choppoint == '7'
1.37 ++ || *choppoint == '8' || *choppoint == '9')
1.38 ++ continue;
1.39 ++ else
1.40 ++ {
1.41 ++ *choppoint = 0;
1.42 ++ break;
1.43 ++ }
1.44 ++ }
1.45 ++ }
1.46 ++
1.47 + /* Now convert it into a number. The string consists of at most
1.48 +- three parts. */
1.49 ++ three parts. Now it does, anyway. ;-) */
1.50 + version = 0;
1.51 + parts = 0;
1.52 + cp = buf;