Hi Michael,
On Thu, 2007-02-08 at 12:10 +1100, Michael Newton wrote:
> ...
> Looks to me like your "else if" clause will never happen.. aren't you
> missing a variable to contain the 3rd element of the release number
> (major.minor.missing) ? Only thing im not sure on is, did linux
> kernel release nums always have 3 components, or do we have to handle
> the possibility that earlier ones may have only 2?
Right you are - good catch. I've written a little test program
(attached) to test out a few combinations, and a fixed patch is
also attached. I'm not sure if there were early releases (pre-
2.6) that had only two release numbers, but the code now handles
it just in case (done with just the one sscanf, so no noticable
extra complexity in handling it)...
13:15 nathans@edge ~ 894> cc x.c
13:15 nathans@edge ~ 895> ./a.out 2.4
i=2 major=2 minor=4 release=0
13:15 nathans@edge ~ 896> ./a.out 2.4.2
i=3 major=2 minor=4 release=2
13:18 nathans@edge ~ 897>
> PS: im not sure if you got the news Daniel is now my (immediate) boss
Nope, hadn't heard (though I did hear about mini-dxm, congratulations!).
cheers.
--
Nathan
x.c
Description: Text Data
fix-linux-percpu-metrics
Description: Text Data
|