[CalendarServer-users] calendarserver 3.2 on Debian unstable throwing error "socket.error: [Errno 22] Invalid argument" out of the box?

Glyph glyph at twistedmatrix.com
Tue Jul 17 16:59:01 PDT 2012


On Jul 17, 2012, at 1:04 AM, Fredrik Unger <fred at tree.se> wrote:

> One problem could be socklen_t. Linux uses size_t [1].
> (yes I read the comment in the code "To forestall portability problems")
> (I do not know Mac:s structs, also 32 bit probably size_t and socklen_t are 4 )
> I have not enough Python/C interface knowledge to know what dragons
> are hidden there..
> 
> For example the cast :
> message_header.msg_controllen = (socklen_t) all_data_len;
> 
> puts an int in the msg.controllen but an long long is expected?
> That cast might not be as bad as setting some length using &.

The compiler should know, at this point in the code, that msg_controllen is a size_t, which is to say, uint64, and ((socklen_t) all_data_len) is a socklen_t, which is to say, int32.  So the cast is valid.  (Doing funky stuff with & might not be, depending on the type specifiers in question.)  So this should never be a problem unless the length is negative.  Which, as far as I can tell, is impossible.

It took me a little while to verify that this is the case - type mismatches in C always worry me - but I am fairly certain this isn't our problem.

-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-users/attachments/20120717/f8e4d2ab/attachment.html>


More information about the calendarserver-users mailing list