[Common-dev] Fwd: Re: Crash in CHXSocket. (when writing to a closed socket.)

[Common-dev] Fwd: Re: Crash in CHXSocket. (when writing to a closed socket.)

Sujeet Kharkar skharkar at real.com
Fri Sep 24 15:43:29 PDT 2004


So should this be checked in?

Thanks
Sujeet

At 06:59 AM 9/24/2004 -0700, Tom Marshall wrote:
> > 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
>
>_______________________________________________
>Common-dev mailing list
>Common-dev at lists.helixcommunity.org
>http://lists.helixcommunity.org/mailman/listinfo/common-dev




More information about the Common-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.