]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/utmp.c: get_session_host(): Reduce scope of variable
authorAlejandro Colomar <alx@kernel.org>
Sun, 18 Feb 2024 01:39:57 +0000 (02:39 +0100)
committerAlejandro Colomar <alx@kernel.org>
Tue, 20 Feb 2024 17:53:53 +0000 (18:53 +0100)
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>
lib/utmp.c

index 528b7d53ef45173fd8277e8be8b0d602171d454a..6c8f43ea4accdec3b9d49d491f9beda30da59673 100644 (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;