1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
From: Samuel Thibault <samuel.thibault@aquilenet.fr>
Date: Tue, 3 Mar 2026 12:28:47 +0100
Subject: Fix build on non-Linux
---
lib/Makemodule.am | 6 +++---
libblkid/src/cache.c | 2 ++
term-utils/agetty.c | 15 ++++++++++++++-
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 9464bd9..5b06c5c 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -31,14 +31,13 @@ libcommon_la_SOURCES = \
lib/mbsalign.c \
lib/mbsedit.c\
lib/md5.c \
- lib/netaddrq.c \
- lib/netlink.c \
lib/pidutils.c \
lib/pidfd-utils.c \
lib/pwdutils.c \
lib/randutils.c \
lib/sha1.c \
lib/sha256.c \
+ lib/shells.c \
lib/signames.c \
lib/strutils.c \
lib/strv.c \
@@ -50,7 +49,8 @@ libcommon_la_SOURCES = \
if LINUX
libcommon_la_SOURCES += \
lib/linux_version.c \
- lib/shells.c \
+ lib/netaddrq.c \
+ lib/netlink.c \
lib/loopdev.c
endif
diff --git a/libblkid/src/cache.c b/libblkid/src/cache.c
index 6a2cc34..0585707 100644
--- a/libblkid/src/cache.c
+++ b/libblkid/src/cache.c
@@ -188,12 +188,14 @@ void blkid_gc_cache(blkid_cache cache)
DBG(CACHE, ul_debugobj(cache, "freeing non-existing %s", dev->bid_name));
blkid_free_dev(dev);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
+#ifdef __linux__
} else if (is_loopdev(dev->bid_name)
&& !loopdev_has_backing_file(dev->bid_name)) {
/* remove empty loop device from cache */
DBG(CACHE, ul_debugobj(cache, "freeing empty loop device %s", dev->bid_name));
blkid_free_dev(dev);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
+#endif
} else {
DBG(CACHE, ul_debug("Device %s exists", dev->bid_name));
}
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 02f8650..82d2d64 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;
@@ -1639,10 +1641,12 @@ static int wait_for_term_input(struct issue *ie, int fd)
FD_SET(inotify_fd, &rfds);
nfds = max(nfds, inotify_fd);
}
+#ifdef AGETTY_RELOAD
if (ie->nl.fd >= 0) {
FD_SET(ie->nl.fd, &rfds);
nfds = max(nfds, ie->nl.fd);
}
+#endif
/* If waiting fails, just fall through, presumably reading input will fail */
if (select(nfds + 1, &rfds, NULL, NULL, NULL) < 0)
@@ -1653,6 +1657,7 @@ static int wait_for_term_input(struct issue *ie, int fd)
}
+#ifdef AGETTY_RELOAD
if (ie->nl.fd >= 0 && FD_ISSET(ie->nl.fd, &rfds)) {
int rc;
@@ -1670,6 +1675,7 @@ static int wait_for_term_input(struct issue *ie, int fd)
} else if (inotify_fd >= 0 && FD_ISSET(inotify_fd, &rfds)) {
while (read(inotify_fd, buffer, sizeof (buffer)) > 0);
}
+#endif
return 0;
}
@@ -1976,7 +1982,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 +2600,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 +2766,7 @@ static void dump_iface_all(struct issue *ie,
if (!first)
fputs("\n", ie->output);
}
+#endif
/*
* parses \x{argument}, if not argument specified then returns NULL, the @fd
|