From b6464f8dc5fdecd1418eb16ec3f8a1cfb151e61b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 7 May 2021 20:38:26 +0200 Subject: [PATCH] blkdiscard: fix compilation without libblkid Signed-off-by: Karel Zak --- sys-utils/blkdiscard.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index 2ccbbaa903..9fa5a4f828 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -37,7 +37,10 @@ #include #include #include -#include + +#ifdef HAVE_LIBBLKID +# include +#endif #include "nls.h" #include "strutils.h" @@ -107,6 +110,7 @@ static void __attribute__((__noreturn__)) usage(void) exit(EXIT_SUCCESS); } +#ifdef HAVE_LIBBLKID /* * Check existing signature on the open fd * Returns 0 signature found @@ -142,6 +146,7 @@ out: blkid_free_probe(pr); return ret; } +#endif /* HAVE_LIBBLKID */ int main(int argc, char **argv) { @@ -252,7 +257,7 @@ int main(int argc, char **argv) if (range[1] % secsize) errx(EXIT_FAILURE, _("%s: length %" PRIu64 " is not aligned " "to sector size %i"), path, range[1], secsize); - +#ifdef HAVE_LIBBLKID /* Check for existing signatures on the device */ switch(probe_device(fd, path)) { case 0: /* signature detected */ @@ -273,6 +278,7 @@ int main(int argc, char **argv) err(EXIT_FAILURE, _("failed to probe the device")); break; } +#endif /* HAVE_LIBBLKID */ stats[0] = range[0], stats[1] = 0; gettime_monotonic(&last); -- 2.47.2