[pulseaudio-discuss] [PATCH] pasuspender: Check pa_context_connect() return value.

Tanu Kaskinen tanu.kaskinen at digia.com
Thu Mar 29 02:18:32 PDT 2012


---
 src/utils/pasuspender.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/utils/pasuspender.c b/src/utils/pasuspender.c
index 0a60923..ac764d2 100644
--- a/src/utils/pasuspender.c
+++ b/src/utils/pasuspender.c
@@ -292,7 +292,11 @@ int main(int argc, char *argv[]) {
     }
 
     pa_context_set_state_callback(context, context_state_callback, NULL);
-    pa_context_connect(context, server, PA_CONTEXT_NOAUTOSPAWN, NULL);
+
+    if (pa_context_connect(context, server, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) {
+        fprintf(stderr, _("pa_context_connect() failed: %s\n"), pa_strerror(pa_context_errno(context)));
+        goto quit;
+    }
 
     if (pa_mainloop_run(m, &ret) < 0) {
         fprintf(stderr, _("pa_mainloop_run() failed.\n"));
-- 
1.7.8



More information about the pulseaudio-discuss mailing list