Skip to content

Instantly share code, notes, and snippets.

@favoretti
Created March 22, 2013 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save favoretti/5221431 to your computer and use it in GitHub Desktop.
Save favoretti/5221431 to your computer and use it in GitHub Desktop.
if (gethostname(host, sizeof(host)) == 0)
host[sizeof(host) - 1] = '\0';
else
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