Fix compilation errors for FreeBSD

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2023-08-22 13:37:25 -04:00
parent 554d840742
commit c3bc04e355
2 changed files with 7 additions and 3 deletions

3
changes/ticket40825 Normal file
View File

@ -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.

View File

@ -26,6 +26,10 @@
#define STR_IMPL(x) #x #define STR_IMPL(x) #x
#define STR(x) STR_IMPL(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 /** Return the name of the compile time libc. Returns NULL if we
* cannot identify the libc. */ * cannot identify the libc. */
const char * const char *
@ -46,8 +50,6 @@ tor_libc_get_name(void)
const char * const char *
tor_libc_get_version_str(void) tor_libc_get_version_str(void)
{ {
#if defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE)
#include <sys/param.h>
#ifdef __DragonFly_version #ifdef __DragonFly_version
return STR(__DragonFly_version); return STR(__DragonFly_version);
#endif #endif
@ -60,7 +62,6 @@ tor_libc_get_version_str(void)
#ifdef OpenBSD #ifdef OpenBSD
return STR(OpenBSD); return STR(OpenBSD);
#endif #endif
#endif /* defined(__BSD_VISIBLE) || defined(__NETBSD_SOURCE) */
#ifdef CHECK_LIBC_VERSION #ifdef CHECK_LIBC_VERSION
const char *version = gnu_get_libc_version(); const char *version = gnu_get_libc_version();
if (version == NULL) if (version == NULL)