mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-06 06:46:29 -04:00
bluez5: handle fd allocation errors
For the timers, only set the data after we allocated the fd because this is checked to free the fd again later.
This commit is contained in:
parent
96594d6716
commit
06ba2f792d
3 changed files with 44 additions and 16 deletions
|
|
@ -3334,13 +3334,17 @@ static int codec_switch_start_timer(struct rfcomm *rfcomm, int timeout_msec)
|
|||
{
|
||||
struct impl *backend = rfcomm->backend;
|
||||
struct itimerspec ts;
|
||||
int res;
|
||||
|
||||
spa_log_debug(backend->log, "rfcomm %p: start timer", rfcomm);
|
||||
if (rfcomm->timer.data == NULL) {
|
||||
res = spa_system_timerfd_create(backend->main_system,
|
||||
CLOCK_MONOTONIC, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
||||
if (res < 0)
|
||||
return res;
|
||||
rfcomm->timer.fd = res;
|
||||
rfcomm->timer.data = rfcomm;
|
||||
rfcomm->timer.func = codec_switch_timer_event;
|
||||
rfcomm->timer.fd = spa_system_timerfd_create(backend->main_system,
|
||||
CLOCK_MONOTONIC, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
||||
rfcomm->timer.mask = SPA_IO_IN;
|
||||
rfcomm->timer.rmask = 0;
|
||||
spa_loop_add_source(backend->main_loop, &rfcomm->timer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue