Hi, On 27 January 2015 at 19:56, Bill Spitzak <[email protected]> wrote: > On 01/27/2015 06:52 AM, Daniel Stone wrote: >> POSIX.1-2001 says that if such >> truncation occurs, then it is unspecified whether the returned >> buffer includes a terminating >> null byte. >> >> I think the best thing to do here would be: >> for (i = 0; i < sizeof(name); i++) { >> if (name[i] == '\0') >> break; >> } >> if (i == sizeof(name)) >> name[0] = '\0'; /* ignore stupid hostnames */ > > > Or make the buffer 1 larger than you tell the function, and put a zero at > the end: > > gethostname(buffer, sizeof(buffer)-1); > buffer[sizeof(buffer)-1] = '\0';
If the hostname's been truncated, then it's not useful for our purposes. Cheers, Daniel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
