diff options
author | Max Kellermann <max@duempel.org> | 2011-08-24 00:05:04 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-08-24 01:47:21 +0200 |
commit | 92c1b8f31e09f47aafc2c50a370058458837fac9 (patch) | |
tree | 9f00a8dd140fabe0e4ca5f7b7b1cfe216ab161a7 | |
parent | 9ffa2604f812668a376df46b881f572d373d9256 (diff) | |
download | mpd-92c1b8f31e09f47aafc2c50a370058458837fac9.tar.gz mpd-92c1b8f31e09f47aafc2c50a370058458837fac9.tar.xz mpd-92c1b8f31e09f47aafc2c50a370058458837fac9.zip |
output/raop: error checking in send_control_command()
-rw-r--r-- | src/output/raop_output_plugin.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/output/raop_output_plugin.c b/src/output/raop_output_plugin.c index e10d44d35..db465643d 100644 --- a/src/output/raop_output_plugin.c +++ b/src/output/raop_output_plugin.c @@ -448,7 +448,9 @@ get_time_for_rtp(struct play_state *state, struct timeval *tout) * Send a control command */ static bool -send_control_command(struct control_data *ctrl, struct raop_data *rd, struct play_state *state) +send_control_command(struct control_data *ctrl, struct raop_data *rd, + struct play_state *state, + GError **error_r) { unsigned char buf[20]; int diff; @@ -473,6 +475,12 @@ send_control_command(struct control_data *ctrl, struct raop_data *rd, struct pla fill_int(buf + 16, state->rtptime); num_bytes = sendto(ctrl->fd, buf, sizeof(buf), 0, (struct sockaddr *) &rd->ctrl_addr, sizeof(rd->ctrl_addr)); + if (num_bytes < 0) { + g_set_error(error_r, raop_output_quark(), errno, + "Unable to send control command: %s", + g_strerror(errno)); + return false; + } return true; } @@ -1360,12 +1368,11 @@ raop_output_play(void *data, const void *chunk, size_t size, } iter = raop_session->raop_list; while (iter) { - if (!send_control_command(&raop_session->ctrl, iter, &raop_session->play_state)) { - g_mutex_unlock(raop_session->list_mutex); - g_set_error(error_r, raop_output_quark(), -1, - "Unable to send control command"); + if (!send_control_command(&raop_session->ctrl, iter, + &raop_session->play_state, + error_r)) goto erexit; - } + iter = iter->next; } g_mutex_unlock(raop_session->list_mutex); |