From: Karel Zak Date: Fri, 19 Oct 2012 14:56:57 +0000 (+0200) Subject: last: stop usig MAXHOSTNAMELEN X-Git-Tag: v2.23-rc1~596 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ff816381500c83bd596af7ae0c1886e8dd494bb;p=thirdparty%2Futil-linux.git last: stop usig MAXHOSTNAMELEN Signed-off-by: Karel Zak --- diff --git a/login-utils/last.c b/login-utils/last.c index 77a890abe8..6516ddebfa 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -419,15 +419,17 @@ addtty(char *ttyname) { static void hostconv(char *arg) { static int first = 1; - static char *hostdot, - name[MAXHOSTNAMELEN]; + static char *hostdot, *name; + char *argdot; if (!(argdot = strchr(arg, '.'))) return; + if (first) { first = 0; - if (gethostname(name, sizeof(name))) + name = xgethostname(); + if (!name) err(EXIT_FAILURE, _("gethostname failed")); hostdot = strchr(name, '.');