> /* check for errors */
> if (i == -1)
> return i;
> /* check that we got a valid packet */
> if (i < sizeof(struct pkthdr))
^^^^^^^^^^^^^^^^^^^^^
> return SHORT_PACKET;
>
> then why don't we simply turn that "<" into "!="? I have the feeling
> that a lot of the sizeof-based problems/non-problems (depending on
> your point of view) will then disappear.
>
Actually, the problem is when you don't check for -1 first.
The < can't be replaced with != since presumably the packet header may
very well be a heck of a lot smaller than the packet itself.
-hpa
-- PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD 1E DF FE 69 EE 35 BD 74 See http://www.zytor.com/~hpa/ for web page and full PGP public key I am Bahá'í -- ask me about it or see http://www.bahai.org/ "To love another person is to see the face of God." -- Les Misérables