summaryrefslogtreecommitdiff
path: root/core/procps/procps-3.2.8-kernel3-uts.patch
blob: a72ae59e3cc7c1d22a1eac84a34c919fc8469b9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff -Naur procps-3.2.8-20110302git.orig/proc/version.c procps-3.2.8-20110302git/proc/version.c
--- procps-3.2.8-20110302git.orig/proc/version.c	2011-06-10 17:00:33.000000000 +0200
+++ procps-3.2.8-20110302git/proc/version.c	2011-06-10 17:20:17.000000000 +0200
@@ -38,10 +38,15 @@
 void init_Linux_version(void) {
     static struct utsname uts;
     int x = 0, y = 0, z = 0;	/* cleared in case sscanf() < 3 */
+    int version_string_depth;
     
     if (uname(&uts) == -1)	/* failure implies impending death */
 	exit(1);
-    if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
+
+    version_string_depth = sscanf(uts.release, "%d.%d.%d", &x, &y, &z);
+	
+    if ((version_string_depth < 2) ||		 /* Non-standard for all known kernels */
+       ((version_string_depth < 3) && (x < 3))) /* Non-standard for 2.x.x kernels */
 	fprintf(stderr,		/* *very* unlikely to happen by accident */
 		"Non-standard uts for running kernel:\n"
 		"release %s=%d.%d.%d gives version code %d\n",