summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2023-08-22 13:37:25 -0400
committerDavid Goulet <dgoulet@torproject.org>2023-08-22 13:37:25 -0400
commitc3bc04e355e67e6cb6c8b87ca8967887770d2b08 (patch)
tree041a79a1f1984e29868af106c90f405e04ab1501
parent554d8407421c0969d4aaa5f86bcf59dd495e86e5 (diff)
downloadtor-c3bc04e355e67e6cb6c8b87ca8967887770d2b08.tar.gz
tor-c3bc04e355e67e6cb6c8b87ca8967887770d2b08.zip
Fix compilation errors for FreeBSD
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--changes/ticket408253
-rw-r--r--src/lib/osinfo/libc.c7
2 files changed, 7 insertions, 3 deletions
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 <sys/param.h>
+#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 <sys/param.h>
#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)