AF_UNIX + SOCK_DGRAM

Chris Liechti cliechti at gmx.net
Mon Jun 24 18:32:48 EDT 2002


[posted and mailed]

"James T. Dennis" <jadestar at idiom.com> wrote in
news:af84af$1dkt$1 at news.idiom.com: 

>> Actually think you have run into a bug in Python's socket module.
>> If it's convenient for you to build your own socket module, change
>> it like this and see what happens (I'm looking at version 2.1 here.)
> 
>> *** socketmodule.c.dist Sun Apr 15 17:21:33 2001
>> --- socketmodule.c      Thu Jun 20 10:10:12 2002
>> ***************
>> *** 597,602 ****
>> --- 597,603 ----
>>         case AF_UNIX:
>>         {
>>                 struct sockaddr_un *a = (struct sockaddr_un *) addr;
>> +               a->sun_path[addrlen - (sizeof(*a) -
>> sizeof(a->sun_path))] = 0; 
>>                 return PyString_FromString(a->sun_path);
>>         }
>>   #endif

why not simply use PyString_FromStringAndSize(const char *v,  int len)?

couln't you just file a patch on SF? should i do it?

>> The address returned from recvfrom is (addr, len), but we've been
>> ignoring len on the theory that the string would be NUL-terminated.
>> It isn't, so there can be some garbage on the end.




-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list