After a recent change in the kernel (their commit 6e094bd) my
wireless interface name is 8 characters long, wlp3s0b1. But
the wmnet code to read the received bytes
totalbytes_in = strtoul(&buffer[7], NULL, 10);
assumed that the interface name in /proc/net/dev would be 6 characters
long (and would start reading at position 7).
In the linux kernel mailing list I reported the regression and none
other than Al Viro replied,
> I am not sure if 'wmnet' could do this better (any suggestions?),
*snort*
well, yes - it's called scanf(). And if one is really, really nervous
about the overhead of <gasp> parsing a bunch of integers (as if fopen/
fgets/fclose alone won't cost enough to make constantly calling that
sucker a bad idea), just use ptr + <something> - 6 instead of
&buffer[<something>] in there. That thing has just found where the
colon was (and replaced it with NUL), so dealing with "the first field
turned out to be too long and shifted everything past it" isn't hard.
******
I also took the oportunity to remove the unused variables diffpackets_{in,out}