lib/utmp.c: get_session_host(): Reduce scope of variable

This silences a warning about an unused variable.

Tested-by: Firas Khalil Khana <firasuke@gmail.com>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-02-20 18:53:53 +01:00
parent 64bcb54fa9
commit 8d1f0bcf99
+2 -1
View File
@@ -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;