From f2e4b9f601fd632c5879b7af68d169d6578ef3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarom=C3=ADr=20C=C3=A1p=C3=ADk?= Date: Mon, 20 Jun 2011 17:54:06 +0200 Subject: [PATCH] Kernel 3.0 version format support --- proc/version.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/proc/version.c b/proc/version.c index 0c3a48f1..a286c1c9 100644 --- a/proc/version.c +++ b/proc/version.c @@ -36,10 +36,15 @@ int linux_version_code; 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",