Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
if (gethostname(host, sizeof(host)) == 0)
host[sizeof(host) - 1] = '\0';
strlcpy(host, "localhost", sizeof(host));
user_info[++i] = fmt_string("host", host);
if (user_info[i] == NULL)
errorx(1, _("unable to allocate memory"));
ud->host = user_info[i] + sizeof("host=") - 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment