From 2aeab75c6893c882800975866178c79dfe85202a Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 17 Feb 2009 20:27:45 +0200 Subject: paplay: check if pa_context_connect() succeed --- src/utils/paplay.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/utils') diff --git a/src/utils/paplay.c b/src/utils/paplay.c index df2edf62..dec80e5c 100644 --- a/src/utils/paplay.c +++ b/src/utils/paplay.c @@ -400,7 +400,10 @@ int main(int argc, char *argv[]) { pa_context_set_state_callback(context, context_state_callback, NULL); /* Connect the context */ - pa_context_connect(context, server, 0, NULL); + if (pa_context_connect(context, server, 0, NULL) < 0) { + fprintf(stderr, _("pa_context_connect() failed: %s"), pa_strerror(pa_context_errno(context))); + goto quit; + } /* Run the main loop */ if (pa_mainloop_run(m, &ret) < 0) { -- cgit From 93ed27d5617202441bd9be346ce916289fe7128d Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 17 Feb 2009 20:31:06 +0200 Subject: pactl: check if pa_context_connect succeed --- src/utils/pactl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/utils') diff --git a/src/utils/pactl.c b/src/utils/pactl.c index 154e7f9c..e020f372 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -1029,7 +1029,10 @@ int main(int argc, char *argv[]) { } pa_context_set_state_callback(context, context_state_callback, NULL); - pa_context_connect(context, server, 0, NULL); + if (pa_context_connect(context, server, 0, NULL) < 0) { + fprintf(stderr, _("pa_context_connect() failed: %s"), pa_strerror(pa_context_errno(context))); + goto quit; + } if (pa_mainloop_run(m, &ret) < 0) { fprintf(stderr, _("pa_mainloop_run() failed.\n")); -- cgit From c3eb9086b819eb7abb0248e0a253c21e5853fe99 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 17 Feb 2009 20:52:11 +0200 Subject: pactl: return in case of error reading file (avoid using freed d) --- src/utils/pactl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/utils') diff --git a/src/utils/pactl.c b/src/utils/pactl.c index e020f372..d3da90e6 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -649,6 +649,7 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) { pa_xfree(d); fprintf(stderr, _("Premature end of file\n")); quit(1); + return; } pa_stream_write(s, d, length, pa_xfree, 0, PA_SEEK_RELATIVE); -- cgit From 67b0baecc41745afcf8591949fbdffb8678fe83f Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 17 Feb 2009 22:17:10 +0200 Subject: pacat: remove unused variable --- src/utils/pacat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 10015ce4..2224da9a 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -336,7 +336,6 @@ static void context_drain_complete(pa_context*c, void *userdata) { /* Stream draining complete */ static void stream_drain_complete(pa_stream*s, int success, void *userdata) { - pa_operation *o; if (!success) { fprintf(stderr, _("Failed to drain stream: %s\n"), pa_strerror(pa_context_errno(context))); @@ -350,7 +349,7 @@ static void stream_drain_complete(pa_stream*s, int success, void *userdata) { pa_stream_unref(stream); stream = NULL; - if (!(o = pa_context_drain(context, context_drain_complete, NULL))) + if (!pa_context_drain(context, context_drain_complete, NULL)) pa_context_disconnect(context); else { if (verbose) -- cgit From bb52a6753b907e18b0de31bffd424b8ed273c5a9 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 17 Feb 2009 22:37:16 +0200 Subject: padsp: don't use si if it's NULL --- src/utils/padsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/padsp.c b/src/utils/padsp.c index 046bae45..76e86c8d 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -1202,7 +1202,7 @@ fail: static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, void *userdata) { fd_info *i = userdata; - if (!si && eol < 0) { + if (!si || eol < 0) { i->operation_success = 0; pa_threaded_mainloop_signal(i->mainloop, 0); return; @@ -1224,7 +1224,7 @@ static void sink_info_cb(pa_context *context, const pa_sink_info *si, int eol, v static void source_info_cb(pa_context *context, const pa_source_info *si, int eol, void *userdata) { fd_info *i = userdata; - if (!si && eol < 0) { + if (!si || eol < 0) { i->operation_success = 0; pa_threaded_mainloop_signal(i->mainloop, 0); return; -- cgit