From 5aeb4ab9ed759d130efc1d1c27ae5afb0b6e9c18 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 2 Dec 2021 11:57:40 +0100 Subject: [PATCH 1/4] configure: fix handling of non linux operating systems The OS whitelist conditional is malformed due to missing test(1) commands causing the following error to be emitted during configure while using something other than Linux: ../configure[3340]: xopenbsd: not found Instead, favor a switch statement which makes the line a bit shorter as well. Also, the AC_MSG_ERROR argument must be wrapped in brackets due to presence of a comma. Otherwise, the tail will be interpreted as an additional argument. --- configure.ac | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index e0dcb10f..32eae4fe 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,13 @@ if test "z$with_os" = "z"; then with_os="linux" fi with_os=`echo ${with_os} | tr '[[:upper:]]' '[[:lower:]]' ` - -if test "x${with_os}" != xlinux && "x${with_os}" != xfreebsd && "x${with_os}" != xdarwin ; then - AC_MSG_ERROR(--with-os= argument must linux freebsd openbsd or darwin) -fi +case "x${with_os}" in +xlinux|xfreebsd|xopenbsd|xdarwin) + ;; +*) + AC_MSG_ERROR([--with-os= argument must be one of linux, freebsd, openbsd or darwin]) + ;; +esac # Checks for programs. AC_PROG_CC From 7693b4ae1b4b45ca7c4eb1de5216179966a6d864 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 2 Dec 2021 12:07:14 +0100 Subject: [PATCH 2/4] configure: openbsd is supported --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 32eae4fe..878fbf2c 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AM_CONDITIONAL([USE_GIT_VERSION], [test -n "$GIT" && test -e ".git/index" ]) # Derived from the Avahi configure.ac file # Specifying the OS type, defaulting to linux. # -AC_ARG_WITH(os, AS_HELP_STRING([--with-os=OSType],[Specify the distribution to target: One of linux freebsd or darwin])) +AC_ARG_WITH(os, AS_HELP_STRING([--with-os=OSType],[Specify the distribution to target: One of linux, freebsd, openbsd or darwin])) if test "z$with_os" = "z"; then with_os="linux" fi From 3b91065c2afa9790182643c9e32f21bcf4835fa4 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Thu, 2 Dec 2021 12:07:55 +0100 Subject: [PATCH 3/4] do not pass null to printf OpenBSD issues a warning using syslog whenever NULL is passed as a variadic argument to the printf-like family of functions. --- shairport.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/shairport.c b/shairport.c index edcb5e10..dab32bf2 100644 --- a/shairport.c +++ b/shairport.c @@ -120,6 +120,8 @@ int this_is_the_daemon_process = 0; #define UUID_STR_LEN 36 #endif +#define strnull(s) ((s) ? (s) : "(null)") + pthread_t rtsp_listener_thread; int killOption = 0; @@ -1976,15 +1978,15 @@ int main(int argc, char **argv) { debug(1, "udp port range is %d.", config.udp_port_range); debug(1, "player name is \"%s\".", config.service_name); debug(1, "backend is \"%s\".", config.output_name); - debug(1, "run_this_before_play_begins action is \"%s\".", config.cmd_start); - debug(1, "run_this_after_play_ends action is \"%s\".", config.cmd_stop); + debug(1, "run_this_before_play_begins action is \"%s\".", strnull(config.cmd_start)); + debug(1, "run_this_after_play_ends action is \"%s\".", strnull(config.cmd_stop)); debug(1, "wait-cmd status is %d.", config.cmd_blocking); debug(1, "run_this_before_play_begins may return output is %d.", config.cmd_start_returns_output); - debug(1, "run_this_if_an_unfixable_error_is_detected action is \"%s\".", config.cmd_unfixable); - debug(1, "run_this_before_entering_active_state action is \"%s\".", config.cmd_active_start); - debug(1, "run_this_after_exiting_active_state action is \"%s\".", config.cmd_active_stop); + debug(1, "run_this_if_an_unfixable_error_is_detected action is \"%s\".", strnull(config.cmd_unfixable)); + debug(1, "run_this_before_entering_active_state action is \"%s\".", strnull(config.cmd_active_start)); + debug(1, "run_this_after_exiting_active_state action is \"%s\".", strnull(config.cmd_active_stop)); debug(1, "active_state_timeout is %f seconds.", config.active_state_timeout); - debug(1, "mdns backend \"%s\".", config.mdns_name); + debug(1, "mdns backend \"%s\".", strnull(config.mdns_name)); debug(2, "userSuppliedLatency is %d.", config.userSuppliedLatency); debug(1, "interpolation setting is \"%s\".", config.packet_stuffing == ST_basic ? "basic" @@ -1995,7 +1997,7 @@ int main(int argc, char **argv) { debug(1, "allow a session to be interrupted: %d.", config.allow_session_interruption); debug(1, "busy timeout time is %d.", config.timeout); debug(1, "drift tolerance is %f seconds.", config.tolerance); - debug(1, "password is \"%s\".", config.password); + debug(1, "password is \"%s\".", strnull(config.password)); debug(1, "ignore_volume_control is %d.", config.ignore_volume_control); if (config.volume_max_db_set) debug(1, "volume_max_db is %d.", config.volume_max_db); From 489a77633be7d7885d50c5313196e3b0ebd79245 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Sun, 5 Dec 2021 09:00:23 +0100 Subject: [PATCH 4/4] add missing includes on openbsd --- common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.c b/common.c index 866222c2..feec44ad 100644 --- a/common.c +++ b/common.c @@ -35,6 +35,7 @@ #include #include #include +#include // PRIdPTR #include #include #include @@ -54,7 +55,7 @@ #include #endif -#ifdef COMPILE_FOR_FREEBSD +#ifdef COMPILE_FOR_BSD #include #include #include