From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Sun, 27 Feb 2022 10:23:14 +0000 (+1100) Subject: Add the opening of the shm interface to the startup process and die if it can't be... X-Git-Tag: 4.1-rc1~24^2~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18ed1bda876e973993fe2b56c5b14cd93deef28a;p=thirdparty%2Fshairport-sync.git Add the opening of the shm interface to the startup process and die if it can't be done. Quieten some debug messages. --- diff --git a/ptp-utilities.c b/ptp-utilities.c index 8b05101e..23ce53ea 100644 --- a/ptp-utilities.c +++ b/ptp-utilities.c @@ -123,7 +123,7 @@ int ptp_shm_interface_open() { int response = 0; if ((mapped_addr == NULL) || (mapped_addr == MAP_FAILED)) { response = -1; - debug(1, "ptp_shm_interface_open"); + debug(2, "ptp_shm_interface_open"); if (strcmp(config.nqptp_shared_memory_interface_name, "") != 0) { response = 0; int shared_memory_file_descriptor = @@ -145,14 +145,14 @@ int ptp_shm_interface_open() { } if (response == 0) - debug(1, "ptp_shm_interface_open successful"); + debug(2, "ptp_shm_interface_open successful"); else - debug(1, "ptp_shm_interface_open failed"); + debug(2, "ptp_shm_interface_open failed"); } else { debug(1, "No config.nqptp_shared_memory_interface_name"); } } else { - debug(1, "ptp_shm_interface_open -- already open!"); + debug(2, "ptp_shm_interface_open -- already open!"); } return response; } diff --git a/shairport.c b/shairport.c index c5dc81fd..b0229e40 100644 --- a/shairport.c +++ b/shairport.c @@ -2214,8 +2214,10 @@ int main(int argc, char **argv) { ptp_shm_interface_init(); ptp_send_control_message_string("T"); // incidentally create the named SHM and remove all previous history usleep(100000); // wait for it to get done (?) - if (ptp_shm_interface_open() != 0) { - debug(1,"unable to open the shm interface at startup!"); + if (ptp_shm_interface_open() == 0) { + debug(1,"shm interface opened successfully!"); + } else { + die("Unable to open the shm interface at startup!"); } #endif