]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: guard netlink-related code with AGETTY_RELOAD
authorKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 11:00:43 +0000 (12:00 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 11:00:43 +0000 (12:00 +0100)
The struct issue nl field and related helper functions use types
and headers (netaddrq.h, linux/netlink.h) that are only available
when AGETTY_RELOAD is defined. Guard the .nl.fd initializations
in main() and show_issue(), and wrap the netlink helper functions
(print_iface_best, print_addrq_bestofall, dump_iface_good,
dump_iface_all) with #ifdef AGETTY_RELOAD.

This fixes compilation on systems without inotify/netlink support
(e.g., GNU/Hurd).

Co-authored-by: Samuel Thibault <samuel.thibault@aquilenet.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/agetty.c

index 02f86502ab82a394e8fb30a6767d148cddffd651..ca404a10054e6a3850e2891b44dce7ec84aefe89 100644 (file)
@@ -365,7 +365,9 @@ int main(int argc, char **argv)
        };
        struct issue issue = {
                .mem = NULL,
+#ifdef AGETTY_RELOAD
                .nl.fd = -1
+#endif
        };
        char *login_argv[LOGIN_ARGV_MAX + 1];
        int login_argc = 0;
@@ -1976,7 +1978,12 @@ done:
  */
 static void show_issue(struct options *op)
 {
-       struct issue ie = { .output = NULL, .nl.fd = -1 };
+       struct issue ie = {
+               .output = NULL,
+#ifdef AGETTY_RELOAD
+               .nl.fd = -1
+#endif
+       };
        struct termios tp;
 
        memset(&tp, 0, sizeof(struct termios));
@@ -2589,6 +2596,7 @@ static void log_warn(const char *fmt, ...)
        va_end(ap);
 }
 
+#ifdef AGETTY_RELOAD
 static void print_iface_best(struct issue *ie,
                             const char *ifname,
                             uint8_t ifa_family)
@@ -2754,6 +2762,7 @@ static void dump_iface_all(struct issue *ie,
        if (!first)
                fputs("\n", ie->output);
 }
+#endif /* AGETTY_RELOAD */
 
 /*
  * parses \x{argument}, if not argument specified then returns NULL, the @fd