From 288b586867005aed92d61354785e58faf98e9e04 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 22 Mar 2021 19:17:36 +0100 Subject: Fix support for long hostnames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- asroot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asroot.c b/asroot.c index be28d13..193926d 100644 --- a/asroot.c +++ b/asroot.c @@ -241,7 +241,8 @@ check_password(void) } *hostname = 0; if (!gethostname(hostname, size)) { - break; + if (!hostname[size - 2]) + break; } else if (errno != ENAMETOOLONG) { fprintf(stderr, "%s: gethostname %zu: %s\n", argv0, size, strerror(errno)); exit(EXIT_ERROR); -- cgit v1.2.3-70-g09d2