[OPEN-ILS-DEV] C nits: errno in _socket_handle_client_data()

Bill Erickson billserickson at gmail.com
Wed May 30 23:22:26 EDT 2007


On 5/29/07, Scott McKellar <mck9 at swbell.net> wrote:
>
> In socket_bundle.c, the _socket_handle_client_data function calls
> clr_fl().  In case of error, the calling function tests the value
> of errno, and if it is not EAGAIN, logs it in a message.
>
> By this time clr_fl() (in utils.c) has already written its own message
> to standard error, using fprintf().  Hence the errno reported in the
> calling function is the value left by fprintf().  What we presumably
> want, however, is the errno value from fcntl(), as called by clr_fl().


It's a little worse than that, actually.  The errno check is for the call to
recv(), a couple of lines up.  How it got so nested, I'm not sure.  I've
added Scott's "local_errno" capturing code to grab errno as set by the
recv() call.   I've also removed the fprintf() calls so one can analyze
errno as set by the last call to fcntl() inside of get/set_fl(), if
necessary.  Sound sane?

Thanks for pointing that out, Scott.

-bill



-- 
Bill Erickson
PINES Systems Developer
Georgia Public Library Service
billserickson at gmail.com
http://open-ils.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070530/e176ef4d/attachment.html


More information about the Open-ils-dev mailing list