From: Alejandro Colomar Date: Sun, 18 Feb 2024 01:39:57 +0000 (+0100) Subject: lib/utmp.c: get_session_host(): Reduce scope of variable X-Git-Tag: 4.15.0-rc3~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d1f0bcf99f1487f8c3eb54d65e0654f7e3f0264;p=thirdparty%2Fshadow.git lib/utmp.c: get_session_host(): Reduce scope of variable This silences a warning about an unused variable. Tested-by: Firas Khalil Khana Reviewed-by: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/lib/utmp.c b/lib/utmp.c index 528b7d53e..6c8f43ea4 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -175,13 +175,14 @@ int get_session_host(char **out) { int ret = 0; - char *hostname; struct utmpx *ut; ut = get_current_utmp(); #ifdef HAVE_STRUCT_UTMP_UT_HOST if ((ut != NULL) && (ut->ut_host[0] != '\0')) { + char *hostname; + hostname = XMALLOC(sizeof(ut->ut_host) + 1, char); ZUSTR2STP(hostname, ut->ut_host); *out = hostname;