From f415e313b4367e740d4c412b60fb9ec86ba00e04 Mon Sep 17 00:00:00 2001 From: Naveen Albert Date: Sun, 29 Sep 2024 09:26:10 -0400 Subject: [PATCH] main, res, tests: Fix compilation errors on FreeBSD. asterisk.c, manager.c: Increase buffer sizes to avoid truncation warnings. config.c: Include header file for WIFEXITED/WEXITSTATUS macros. res_timing_kqueue: Use more portable format specifier. test_crypto: Use non-linux limits.h header file. Resolves: #916 --- main/asterisk.c | 2 +- main/config.c | 1 + main/manager.c | 2 +- res/res_timing_kqueue.c | 2 +- tests/test_crypto.c | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main/asterisk.c b/main/asterisk.c index 78fc4e33fd..0b3c901117 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -4339,7 +4339,7 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou if (ast_opt_console) { /* Console stuff now... */ /* Register our quit function */ - char title[256]; + char title[296]; char hostname[MAXHOSTNAMELEN] = ""; if (gethostname(hostname, sizeof(hostname) - 1)) { diff --git a/main/config.c b/main/config.c index 10086c2e7f..d20578bd2f 100644 --- a/main/config.c +++ b/main/config.c @@ -44,6 +44,7 @@ #include #include #include +#include #include /* HUGE_VAL */ #include diff --git a/main/manager.c b/main/manager.c index fdf64d52b2..a59889f22d 100644 --- a/main/manager.c +++ b/main/manager.c @@ -9443,7 +9443,7 @@ static int __init_manager(int reload, int by_external_config) struct ast_manager_user *user = NULL; struct ast_variable *var; struct ast_flags config_flags = { (reload && !by_external_config) ? CONFIG_FLAG_FILEUNCHANGED : 0 }; - char a1[256]; + char a1[337]; char a1_hash[256]; struct ast_sockaddr ami_desc_local_address_tmp; struct ast_sockaddr amis_desc_local_address_tmp; diff --git a/res/res_timing_kqueue.c b/res/res_timing_kqueue.c index f568144aa5..d61f3d8734 100644 --- a/res/res_timing_kqueue.c +++ b/res/res_timing_kqueue.c @@ -466,7 +466,7 @@ AST_TEST_DEFINE(test_kqueue_timing) } diff = ast_tvdiff_us(ast_tvnow(), start); - ast_test_status_update(test, "diff is %llu\n", diff); + ast_test_status_update(test, "diff is %" PRIu64 "\n", diff); } while (0); kqueue_timer_close(kt); return res; diff --git a/tests/test_crypto.c b/tests/test_crypto.c index 8b52c9df38..8e83800ba8 100644 --- a/tests/test_crypto.c +++ b/tests/test_crypto.c @@ -41,7 +41,7 @@ #include #include -#include +#include #include static const char *keypair1 = "rsa_key1";