|
perex |
140af3 |
From cf23b804e022e6d9c0e1894fed887a735963a127 Mon Sep 17 00:00:00 2001
|
|
perex |
140af3 |
From: Takashi Iwai <tiwai@suse.de>
|
|
perex |
140af3 |
Date: Wed, 16 Jul 2008 15:15:42 +0200
|
|
perex |
140af3 |
Subject: [PATCH] pulse - Returns errors instead of assert()
|
|
perex |
140af3 |
|
|
perex |
140af3 |
Some sanity checks in pcm_pulse.c with assert() causes the program to
|
|
perex |
140af3 |
abort unexpectedly when the pulseaudio daemon is dead. This is
|
|
perex |
140af3 |
suboptimal. Examples:
|
|
perex |
140af3 |
https://bugzilla.novell.com/show_bug.cgi?id=409532
|
|
perex |
140af3 |
|
|
perex |
140af3 |
Now fixed to return an error instead.
|
|
perex |
140af3 |
|
|
perex |
140af3 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
perex |
140af3 |
---
|
|
perex |
140af3 |
pulse/pcm_pulse.c | 20 ++++++++++++++++----
|
|
perex |
140af3 |
1 files changed, 16 insertions(+), 4 deletions(-)
|
|
perex |
140af3 |
|
|
perex |
140af3 |
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
|
|
perex |
140af3 |
index e4a6232..efff509 100644
|
|
perex |
140af3 |
--- a/pulse/pcm_pulse.c
|
|
perex |
140af3 |
+++ b/pulse/pcm_pulse.c
|
|
perex |
140af3 |
@@ -83,7 +83,10 @@ static int pulse_start(snd_pcm_ioplug_t *io)
|
|
perex |
140af3 |
goto finish;
|
|
perex |
140af3 |
|
|
perex |
140af3 |
o = pa_stream_cork(pcm->stream, 0, pulse_stream_success_cb, pcm->p);
|
|
perex |
140af3 |
- assert(o);
|
|
perex |
140af3 |
+ if (!o) {
|
|
perex |
140af3 |
+ err = -EIO;
|
|
perex |
140af3 |
+ goto finish;
|
|
perex |
140af3 |
+ }
|
|
perex |
140af3 |
|
|
perex |
140af3 |
err = pulse_wait_operation(pcm->p, o);
|
|
perex |
140af3 |
|
|
perex |
140af3 |
@@ -122,7 +125,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
|
|
perex |
140af3 |
goto finish;
|
|
perex |
140af3 |
|
|
perex |
140af3 |
o = pa_stream_flush(pcm->stream, pulse_stream_success_cb, pcm->p);
|
|
perex |
140af3 |
- assert(o);
|
|
perex |
140af3 |
+ if (!o) {
|
|
perex |
140af3 |
+ err = -EIO;
|
|
perex |
140af3 |
+ goto finish;
|
|
perex |
140af3 |
+ }
|
|
perex |
140af3 |
|
|
perex |
140af3 |
err = pulse_wait_operation(pcm->p, o);
|
|
perex |
140af3 |
|
|
perex |
140af3 |
@@ -134,7 +140,10 @@ static int pulse_stop(snd_pcm_ioplug_t *io)
|
|
perex |
140af3 |
}
|
|
perex |
140af3 |
|
|
perex |
140af3 |
o = pa_stream_cork(pcm->stream, 1, pulse_stream_success_cb, pcm->p);
|
|
perex |
140af3 |
- assert(o);
|
|
perex |
140af3 |
+ if (!o) {
|
|
perex |
140af3 |
+ err = -EIO;
|
|
perex |
140af3 |
+ goto finish;
|
|
perex |
140af3 |
+ }
|
|
perex |
140af3 |
|
|
perex |
140af3 |
err = pulse_wait_operation(pcm->p, o);
|
|
perex |
140af3 |
|
|
perex |
140af3 |
@@ -169,7 +178,10 @@ int pulse_drain(snd_pcm_ioplug_t *io)
|
|
perex |
140af3 |
goto finish;
|
|
perex |
140af3 |
|
|
perex |
140af3 |
o = pa_stream_drain(pcm->stream, pulse_stream_success_cb, pcm->p);
|
|
perex |
140af3 |
- assert(o);
|
|
perex |
140af3 |
+ if (!o) {
|
|
perex |
140af3 |
+ err = -EIO;
|
|
perex |
140af3 |
+ goto finish;
|
|
perex |
140af3 |
+ }
|
|
perex |
140af3 |
|
|
perex |
140af3 |
err = pulse_wait_operation(pcm->p, o);
|
|
perex |
140af3 |
|
|
perex |
140af3 |
--
|
|
perex |
140af3 |
1.5.5.1
|
|
perex |
140af3 |
|