diff options
author | Karel Zak | 2012-10-19 16:56:57 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-19 16:56:57 +0200 |
commit | 7ff816381500c83bd596af7ae0c1886e8dd494bb (patch) | |
tree | 966401ccabc66cec60337ce2169ab474c17e3976 /login-utils/last.c | |
parent | write: stop using MAXHOSTNAMELEN (diff) | |
download | kernel-qcow2-util-linux-7ff816381500c83bd596af7ae0c1886e8dd494bb.tar.gz kernel-qcow2-util-linux-7ff816381500c83bd596af7ae0c1886e8dd494bb.tar.xz kernel-qcow2-util-linux-7ff816381500c83bd596af7ae0c1886e8dd494bb.zip |
last: stop usig MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r-- | login-utils/last.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/login-utils/last.c b/login-utils/last.c index 77a890abe..6516ddebf 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, '.'); |