[Common-dev] Fwd: Re: Crash in CHXSocket. (when writing to a closed socket.)
Tom Marshall tmarshall at helixcommunity.org> I agree - writing to a closed socket should definitely return
> an error of some sort - not just silently do nothing.
EBADF and ENOTSOCK are both errors.
> >Writing to a socket after you close it is illogical. It seems the code
> >that calls write after closing a socket should be fixed.
Yup, totally agreed. But the socket shouldn't deref a NULL ptr when broken
code does this, either.
> >I wonder if the write methods should just have a check such as follows.
> >
> >if (!m_pSendBuffer)
> >{
> >return HXR_UNEXPECTED; // or other ???
> >}
No, it wastes code. This is an operation that indicates an error in the
user code. It is not expected and it should not happen often, if at all.
What is wrong with letting the driver return EBADF/ENOTSOCK?
> >That seems like a more direct fix. The other seems like a masking fix.
> >Maybe I'm being persnickety.
I don't understand what a "masking fix" is. Can you explain?
--
Data is a lot like humans: It is born. Matures. Gets married to other data,
divorced. Gets old. One thing that it doesn't do is die. It has to be killed.
-- Arthur Miller
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.helixcommunity.org/pipermail/common-dev/attachments/20040924/a651e23a/attachment.bin