Stop assuming the presence of minor and patch version numbers; missing
values are defaulted to 0 (e.g. 3.0.0).
Reported by a few people on IRC.
int patch_version;
char *p;
uname(&name);
+
p=name.release;
major_version = atoi(p);
- p=strchr(p,'.')+1;
- minor_version = atoi(p);
- p=strchr(p,'.')+1;
- patch_version = atoi(p);
+ minor_version = patch_version = 0;
+ p=strchr(p,'.');
+ if (p != NULL) {
+ minor_version = atoi(++p);
+ p=strchr(p,'.');
+ if (p != NULL)
+ patch_version = atoi(++p);
+ }
+
if (major_version<2) {
lose("linux kernel version too old: major version=%d (can't run in version < 2.0.0)\n",
major_version);