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 <[email protected]> wrote:
> 
> 
>> On Feb 9, 2015, at 11:40 AM, Chandler Carruth <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Nits:
>> 
>> On Mon, Feb 9, 2015 at 11:23 AM, Ben Langmuir <[email protected] 
>> <mailto:[email protected]>> 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
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to