diff --git a/sysdeps/linux/open.c b/sysdeps/linux/open.c index b10358f1..bbbf0df2 100644 --- a/sysdeps/linux/open.c +++ b/sysdeps/linux/open.c @@ -37,11 +37,15 @@ static void set_linux_version(glibtop *server) { struct utsname uts; unsigned x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ + int version_string_depth; if (uname(&uts) == -1) /* failure most likely implies impending death */ glibtop_error_r(server, "uname() failed"); - if (sscanf(uts.release, "%u.%u.%u", &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 */ glibtop_warn_r(server, "Non-standard uts for running kernel:\n" "release %s=%u.%u.%u gives version code %d\n",