r228592 - Add the hostname to the module hash to avoid sharing between hosts

Ben Langmuir blangmuir at apple.com
Mon Feb 9 12:16:39 PST 2015


In r228601 I check the return value to avoid needing to zero the end, and added a comment that when it fails we just ignore hostname.

> On Feb 9, 2015, at 11:51 AM, Ben Langmuir <blangmuir at apple.com> wrote:
> 
> 
>> On Feb 9, 2015, at 11:40 AM, Chandler Carruth <chandlerc at google.com <mailto:chandlerc at google.com>> wrote:
>> 
>> Nits:
>> 
>> On Mon, Feb 9, 2015 at 11:23 AM, Ben Langmuir <blangmuir at apple.com <mailto:blangmuir at apple.com>> wrote:
>> +  char hostname[256];
>> +  hostname[255] = 0;
>> +  hostname[0] = 0;
>> +  gethostname(hostname, 255);
>> 
>> It would be good to document that we want to actively ignore any error here.
>> 
>> Also, pedantically you should set [255] to 0 here rather than above. POSIX doesn't require null termination in the event it is truncated.
> 
> Ah, I misread the manpage as saying the max length was always <= 255, which is why I thought we couldn’t get ENAMETOOLONG or truncate.  Will fix as suggested.
> 
> Thanks for the review,
> 
> Ben
> 
>> 
>> +  code = hash_combine(code, StringRef(hostname));
>> +#endif
>> 
>> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150209/d3e789b1/attachment.html>


More information about the cfe-commits mailing list