summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch')
-rw-r--r--meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch b/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
new file mode 100644
index 0000000000..2582857e25
--- /dev/null
+++ b/meta/recipes-extended/procps/procps-3.2.8/gnu-kbsd-version.patch
@@ -0,0 +1,44 @@
1Upstream-Status: Inappropriate [not author, no upstream]
2
3Imported from Debian.
4Source: http://anonscm.debian.org/gitweb/?p=collab-maint/procps.git;a=blob;f=debian/patches/gnu-kbsd-version.patch;h=fe5489fc772a3355ff8c0dcf9b953bf0c05aa9f8;hb=b460cfd726b019f8d918b380f78af4c19c5f3e50
5Bugtracker: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632749
6
7Stops procps utilities from printing a warning when used with
8kernels having only two digit versions, e.g. 3.0.
9
10Author: <csmall@debian.org>
11Description: Rework version parsing so its ok with other OSes
12--- a/proc/version.c
13+++ b/proc/version.c
14@@ -35,15 +35,23 @@
15
16 static void init_Linux_version(void) __attribute__((constructor));
17 static void init_Linux_version(void) {
18- static struct utsname uts;
19- int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
20+ int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 2 */
21+ FILE *fp;
22+ char buf[256];
23
24- if (uname(&uts) == -1) /* failure implies impending death */
25- exit(1);
26- if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
27+ if ( (fp=fopen("/proc/version","r")) == NULL) /* failure implies impending death */
28+ exit(1);
29+ if (fgets(buf, 256, fp) == NULL) {
30+ fprintf(stderr, "Cannot read kernel version from /proc/version\n");
31+ fclose(fp);
32+ exit(1);
33+ }
34+ fclose(fp);
35+ if (sscanf(buf, "Linux version %d.%d.%d", &x, &y, &z) < 2)
36 fprintf(stderr, /* *very* unlikely to happen by accident */
37 "Non-standard uts for running kernel:\n"
38- "release %s=%d.%d.%d gives version code %d\n",
39- uts.release, x, y, z, LINUX_VERSION(x,y,z));
40+ "release %s=%d.%d.%d gives version code %d\n",
41+ buf,
42+ x, y, z, LINUX_VERSION(x,y,z));
43 linux_version_code = LINUX_VERSION(x, y, z);
44 }