* Nils Carlson ([email protected]) wrote:
>
> On Mar 31, 2011, at 9:38 PM, Mathieu Desnoyers wrote:
>
>> * Nils Carlson ([email protected]) wrote:

[...]

>>> +   while ((dirent = readdir(tmp_dir))) {
>>> +           if (!strncmp(dirent->d_name, USER_SOCK_DIR_BASE,
>>> +                        strlen(USER_SOCK_DIR_BASE))) {
>>
>> I think there is an off by one here. strlen does not include the final
>> \0, so if we have:
>>
>> string 1:   "blahaaaa\0"
>> string 2:   "blah\0"
>>
>> They will appear as identical although they are different.
>>
>
> No, this is the whole point. We only compare to see if we have a  
> directory prefixed with "/tmp/ust-socks-", if we included the \0 this  
> wouldn't work.
>

Oh! :) This wasn't obvious. Please add a comment.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to