From: Karel Zak Date: Tue, 3 Mar 2026 11:00:43 +0000 (+0100) Subject: agetty: guard netlink-related code with AGETTY_RELOAD X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b82c580054712607a20285130cfbf9d249256e01;p=thirdparty%2Futil-linux.git agetty: guard netlink-related code with AGETTY_RELOAD 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 Signed-off-by: Karel Zak --- diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 02f86502a..ca404a100 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -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