diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-03-04 05:30:28 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-03-04 05:32:26 +0100 |
commit | ec1c92347da686de0a4d8cd0886488a320e3d59f (patch) | |
tree | 8a58bbacdf84656dd7f55c6261b141d12aa35832 | |
parent | 0dd8a3306f552c5f9d5fa69635df617ecf503b2f (diff) |
print error code when suspend/resume fails
-rw-r--r-- | src/pulsecore/cli-command.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 334d05d1..b5f7e7f5 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -32,6 +32,7 @@ #include <ltdl.h> #include <pulse/xmalloc.h> +#include <pulse/error.h> #include <pulsecore/module.h> #include <pulsecore/sink.h> @@ -1236,7 +1237,7 @@ static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_str static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { const char *n, *m; pa_sink *sink; - int suspend; + int suspend, r; pa_core_assert_ref(c); pa_assert(t); @@ -1263,14 +1264,16 @@ static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *b return -1; } - pa_sink_suspend(sink, suspend); + if ((r = pa_sink_suspend(sink, suspend)) < 0) + pa_strbuf_printf(buf, "Failed to resume/suspend sink: %s\n", pa_strerror(r)); + return 0; } static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { const char *n, *m; pa_source *source; - int suspend; + int suspend, r; pa_core_assert_ref(c); pa_assert(t); @@ -1297,14 +1300,15 @@ static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf return -1; } - pa_source_suspend(source, suspend); + if ((r = pa_source_suspend(source, suspend)) < 0) + pa_strbuf_printf(buf, "Failed to resume/suspend source: %s\n", pa_strerror(r)); + return 0; } static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { const char *m; - int suspend; - int ret; + int suspend, r; pa_core_assert_ref(c); pa_assert(t); @@ -1321,12 +1325,11 @@ static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p return -1; } - ret = - (pa_sink_suspend_all(c, suspend) < 0); - if (pa_source_suspend_all(c, suspend) < 0) - ret = -1; + if ((r = pa_sink_suspend_all(c, suspend)) < 0) + pa_strbuf_printf(buf, "Failed to resume/suspend all sinks: %s\n", pa_strerror(r)); - if (ret < 0) - pa_strbuf_puts(buf, "Failed to resume/suspend all sinks/sources.\n"); + if ((r = pa_source_suspend_all(c, suspend)) < 0) + pa_strbuf_printf(buf, "Failed to resume/suspend all sources: %s\n", pa_strerror(r)); return 0; } |