int i = read(socket, buffer, sizeof(buffer));
/* 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.
(A function like read isn't supposed to return a count larger than
the buffer size. If it does, we are in deep s. anyway.)
Morten