diff options
author | pmalhaire <7273249+pmalhaire@users.noreply.github.com> | 2018-04-06 00:41:22 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-05 19:41:22 -0300 |
commit | 0505a7cfe1e59a7c0aee003b8d3180b190f9645b (patch) | |
tree | eecc3ad1f45b9b663deee67ad5051d157ceeaa6b | |
parent | cf04300d49b70895fa5f4dc420c4a8d5b08844f5 (diff) |
macOS: fix the switched version test (#772)
-rw-r--r-- | darwin/DarwinProcessList.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c index b4e26347..4a580acc 100644 --- a/darwin/DarwinProcessList.c +++ b/darwin/DarwinProcessList.c @@ -38,12 +38,17 @@ void GetKernelVersion(struct kern *k) { memcpy(k->version, version_, sizeof(version_)); } +/* compare the given os version with the one installed returns: +0 if equals the installed version +positive value if less than the installed version +negative value if more than the installed version +*/ int CompareKernelVersion(short int major, short int minor, short int component) { struct kern k; GetKernelVersion(&k); - if ( k.version[0] != major) return major - k.version[0]; - if ( k.version[1] != minor) return minor - k.version[1]; - if ( k.version[2] != component) return component - k.version[2]; + if ( k.version[0] != major) return k.version[0] - major; + if ( k.version[1] != minor) return k.version[1] - minor; + if ( k.version[2] != component) return k.version[2] - component; return 0; } |