From: Mike Brady Date: Tue, 15 Jan 2019 08:30:00 +0000 (+0000) Subject: Block on command_execute for unfixable errors. X-Git-Tag: 3.3RC0~66^2~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44830377193c341ec7aff8e0320ff07fd9bbd519;p=thirdparty%2Fshairport-sync.git Block on command_execute for unfixable errors. --- diff --git a/common.c b/common.c index 05edae98..729bcacd 100644 --- a/common.c +++ b/common.c @@ -739,7 +739,7 @@ void command_start(void) { } } } -void command_execute(const char *command, const char *extra_argument) { +void command_execute(const char *command, const char *extra_argument, const int block) { // this has a cancellation point if waiting is enabled if (command) { char new_command_buffer[1024]; @@ -767,7 +767,7 @@ void command_execute(const char *command, const char *extra_argument) { exit(127); /* only if execv fails */ } } else { - if (config.cmd_blocking) { /* pid!=0 means parent process and if blocking is true, wait for + if (block) { /* pid!=0 means parent process and if blocking is true, wait for process to finish */ pid_t rc = waitpid(pid, 0, 0); /* wait for child to exit */ if (rc != pid) { diff --git a/common.h b/common.h index 6f07f6d3..c6d5ae3a 100644 --- a/common.h +++ b/common.h @@ -309,7 +309,7 @@ int config_set_lookup_bool(config_t *cfg, char *where, int *dst); void command_start(void); void command_stop(void); -void command_execute(const char *command, const char *extra_argument); +void command_execute(const char *command, const char *extra_argument, const int block); void command_set_volume(double volume); int mkpath(const char *path, mode_t mode); diff --git a/player.c b/player.c index 36461c45..ba40bf5b 100644 --- a/player.c +++ b/player.c @@ -1098,7 +1098,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) { (conn->unfixable_error_reported == 0)) { conn->unfixable_error_reported = 1; if (config.cmd_unfixable) { - command_execute(config.cmd_unfixable, "output_device_stalled"); + command_execute(config.cmd_unfixable, "output_device_stalled", 1); } else { warn( "an unrecoverable error, \"output_device_stalled\", has been detected.", @@ -2010,7 +2010,7 @@ void *player_thread_func(void *arg) { "stalled. Executing the " "\"run_this_if_an_unfixable_error_is_detected\" command.", conn->connection_number); - command_execute(config.cmd_unfixable, "output_device_stalled"); + command_execute(config.cmd_unfixable, "output_device_stalled", 1); } else { warn("Connection %d: An unfixable error has been detected -- output device is " "stalled. \"No " diff --git a/rtsp.c b/rtsp.c index 6e98944f..4a0be9ba 100644 --- a/rtsp.c +++ b/rtsp.c @@ -296,7 +296,7 @@ void *player_watchdog_thread_code(void *arg) { } else if (conn->watchdog_barks == 3) { if ((config.cmd_unfixable) && (conn->unfixable_error_reported == 0)) { conn->unfixable_error_reported = 1; - command_execute(config.cmd_unfixable, "unable_to_cancel_play_session"); + command_execute(config.cmd_unfixable, "unable_to_cancel_play_session",1); } else { warn("an unrecoverable error, \"unable_to_cancel_play_session\", has been detected.", conn->connection_number);