On Sun, Oct 14, 2012 at 10:12:49PM -0400, Mike Frysinger wrote: > On Sunday 14 October 2012 16:20:54 Sami Kerola wrote: > > + host = xmalloc(sizeof(char) * (sysconf(_SC_HOST_NAME_MAX) + 1)); > > + if (gethostname(host, sysconf(_SC_HOST_NAME_MAX)) < 0) > > sysconf() isn't labeled pure or anything, so it'd be better imo to store this > in a local var so you don't waste time calling it twice. > long len = sysconf(...); I agree. IMHO it would be nice to add somewhere to the include/ directory a robust function that always returns the size. Something like: static inline size_t get_hostname_max(void) { long len = sysconf(_SC_HOST_NAME_MAX); if (len > 0) return len; return 64; } Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html