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

Ben Langmuir blangmuir at apple.com
Mon Feb 9 11:51:47 PST 2015


> On Feb 9, 2015, at 11:40 AM, Chandler Carruth <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
> 
> 

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


More information about the cfe-commits mailing list