]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/utmp.c: Remove #endif comments
authorAlejandro Colomar <alx@kernel.org>
Tue, 20 Feb 2024 18:25:37 +0000 (19:25 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 21 Feb 2024 17:17:47 +0000 (18:17 +0100)
Indentation makes it clear which is which.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 7e94a2f4841a ("lib/utmp.c: Remove #endif comments")
[alx: This is needed by 1af6b68cbeb9 ("lib/utmp.c: Use the appropriate autotools macros for struct utmpx")]
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/utmp.c

index dc9e2b7f2d36211004d8b8e4a82d9b1ea5c4b3ca..aee604d74d9e1f994dfdd7d2fbe3e627f96a04f2 100644 (file)
@@ -183,7 +183,7 @@ get_session_host(char **out)
 #else
        *out = NULL;
        ret = -2;
-#endif /* HAVE_STRUCT_UTMP_UT_HOST */
+#endif
 
        return ret;
 }
@@ -249,7 +249,7 @@ prepare_utmp(const char *name, const char *line, const char *host,
                hostname = XMALLOC(sizeof(ut->ut_host) + 1, char);
                strncpy (hostname, ut->ut_host, sizeof (ut->ut_host));
                hostname[sizeof (ut->ut_host)] = '\0';
-#endif                         /* HAVE_STRUCT_UTMP_UT_HOST */
+#endif
        }
 
        if (strncmp(line, "/dev/", 5) == 0) {
@@ -271,17 +271,17 @@ prepare_utmp(const char *name, const char *line, const char *host,
        }
 #ifdef HAVE_STRUCT_UTMP_UT_NAME
        strncpy (utent->ut_name, name,      sizeof (utent->ut_name));
-#endif                         /* HAVE_STRUCT_UTMP_UT_NAME */
+#endif
        strncpy (utent->ut_user, name,      sizeof (utent->ut_user) - 1);
        if (NULL != hostname) {
                struct addrinfo *info = NULL;
 #ifdef HAVE_STRUCT_UTMP_UT_HOST
                strncpy (utent->ut_host, hostname, sizeof (utent->ut_host) - 1);
-#endif                         /* HAVE_STRUCT_UTMP_UT_HOST */
+#endif
 #ifdef HAVE_STRUCT_UTMP_UT_SYSLEN
                utent->ut_syslen = MIN (strlen (hostname),
                                        sizeof (utent->ut_host));
-#endif                         /* HAVE_STRUCT_UTMP_UT_SYSLEN */
+#endif
 #if defined(HAVE_STRUCT_UTMP_UT_ADDR) || defined(HAVE_STRUCT_UTMP_UT_ADDR_V6)
                if (getaddrinfo (hostname, NULL, NULL, &info) == 0) {
                        /* getaddrinfo might not be reliable.
@@ -295,7 +295,7 @@ prepare_utmp(const char *name, const char *line, const char *host,
                                        &(sa->sin_addr),
                                        MIN (sizeof (utent->ut_addr),
                                             sizeof (sa->sin_addr)));
-# endif                                /* HAVE_STRUCT_UTMP_UT_ADDR */
+# endif
 # ifdef HAVE_STRUCT_UTMP_UT_ADDR_V6
                                memcpy (utent->ut_addr_v6,
                                        &(sa->sin_addr),
@@ -308,11 +308,11 @@ prepare_utmp(const char *name, const char *line, const char *host,
                                        &(sa->sin6_addr),
                                        MIN (sizeof (utent->ut_addr_v6),
                                             sizeof (sa->sin6_addr)));
-# endif                                /* HAVE_STRUCT_UTMP_UT_ADDR_V6 */
+# endif
                        }
                        freeaddrinfo (info);
                }
-#endif         /* HAVE_STRUCT_UTMP_UT_ADDR || HAVE_STRUCT_UTMP_UT_ADDR_V6 */
+#endif
                free (hostname);
        }
        /* ut_exit is only for DEAD_PROCESS */
@@ -320,10 +320,10 @@ prepare_utmp(const char *name, const char *line, const char *host,
        if (gettimeofday (&tv, NULL) == 0) {
 #ifdef HAVE_STRUCT_UTMP_UT_TIME
                utent->ut_time = tv.tv_sec;
-#endif                         /* HAVE_STRUCT_UTMP_UT_TIME */
+#endif
 #ifdef HAVE_STRUCT_UTMP_UT_XTIME
                utent->ut_xtime = tv.tv_usec;
-#endif                         /* HAVE_STRUCT_UTMP_UT_XTIME */
+#endif
                utent->ut_tv.tv_sec  = tv.tv_sec;
                utent->ut_tv.tv_usec = tv.tv_usec;
        }
@@ -353,7 +353,7 @@ setutmp(struct utmpx *ut)
 #ifndef USE_PAM
        /* This is done by pam_lastlog */
        updwtmpx(_WTMP_FILE, ut);
-#endif                         /* ! USE_PAM */
+#endif
 
        return err;
 }