From c3bc04e355e67e6cb6c8b87ca8967887770d2b08 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 22 Aug 2023 13:37:25 -0400 Subject: [PATCH] Fix compilation errors for FreeBSD Signed-off-by: David Goulet --- changes/ticket40825 | 3 +++ src/lib/osinfo/libc.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changes/ticket40825 diff --git a/changes/ticket40825 b/changes/ticket40825 new file mode 100644 index 0000000000..36b5db2a9e --- /dev/null +++ b/changes/ticket40825 @@ -0,0 +1,3 @@ + o Minor bugfix (FreeBSD, compilation): + - Fix compilation issue on FreeBSD by properly importing sys/param.h. Fixes + bug 40825; bugfix on 0.4.8.1-alpha. diff --git a/src/lib/osinfo/libc.c b/src/lib/osinfo/libc.c index 1ca26ff707..f7cfde8642 100644 --- a/src/lib/osinfo/libc.c +++ b/src/lib/osinfo/libc.c @@ -26,6 +26,10 @@ #define STR_IMPL(x) #x #define STR(x) STR_IMPL(x) +#if defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE) +#include +#endif /* defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE) */ + /** Return the name of the compile time libc. Returns NULL if we * cannot identify the libc. */ const char * @@ -46,8 +50,6 @@ tor_libc_get_name(void) const char * tor_libc_get_version_str(void) { -#if defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE) -#include #ifdef __DragonFly_version return STR(__DragonFly_version); #endif @@ -60,7 +62,6 @@ tor_libc_get_version_str(void) #ifdef OpenBSD return STR(OpenBSD); #endif -#endif /* defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE) */ #ifdef CHECK_LIBC_VERSION const char *version = gnu_get_libc_version(); if (version == NULL)