Firewall Wizards mailing list archives

Re: Code reviews [Was: FWTK and smap/smapd]


From: Carson Gaspar <carson () taltos org>
Date: Tue, 23 Jul 2002 10:33:17 -0400



--On Tuesday, July 23, 2002 4:21 AM +0400 ark () eltex ru wrote:

It depends on what the maximum buflen is, isn't it?

If we have a small buffer that we know does fit send queue we may
assume that if write count is not equal to expected size something
wrong happens with the socket and we may shut the connection down
diagnosing network error, am i wrong?

If the buffer size can really grow that much we need something like
net_write, sure.

Ah, but I cleverly failed to tell you:

- How much data you were dealing with
- Whether the fd was blocking or non-blocking

In my opinion, anyone who _ever_ assumes write(fd, buf, n) will only ever return n or -1 is writing bogus code. Always program defensively - you may be a genius, but the person who mangles your code later won't be.

--
Carson

_______________________________________________
firewall-wizards mailing list
firewall-wizards () honor icsalabs com
http://honor.icsalabs.com/mailman/listinfo/firewall-wizards


Current thread: