[Git][pulseaudio/pulseaudio][master] cli-command: Fix wrong condition check of pa_module_load
PulseAudio Marge Bot (@pulseaudio-merge-bot)
gitlab at gitlab.freedesktop.org
Fri Apr 5 13:39:13 UTC 2024
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
6c77b019 by kwangshik.kim at 2024-04-05T09:31:47-04:00
cli-command: Fix wrong condition check of pa_module_load
pa_module_load API's return value is integer which is
enum pa_error_code_t with minus such as -PA_ERR_IO
if the module loading is failed.
pa_cli_command_load gets a return value of pa_module_load
as pa_error_code_t which is wrong.
Minus integer value could not covert to enum which is defined
equal or larger than 0 so that pa_cli_command_load would
recognize the return value as larger than 0 if pa_module_load
return value (integer) is minus.
To fix this issue, I modified return value check logic
of pa_module_load API.
As same as pa_module_load's return type, integer would be used
to check if module load is failed in pa_cli_command_load
and the return value would be compared with minus.
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/3801
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/814>
- - - - -
1 changed file:
- src/pulsecore/cli-command.c
Changes:
=====================================
src/pulsecore/cli-command.c
=====================================
@@ -424,7 +424,7 @@ static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool
static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) {
const char *name;
- pa_error_code_t err;
+ int err;
pa_module *m = NULL;
pa_core_assert_ref(c);
@@ -438,7 +438,7 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool
}
if ((err = pa_module_load(&m, c, name, pa_tokenizer_get(t, 2))) < 0) {
- if (err == PA_ERR_EXIST) {
+ if (err == -PA_ERR_EXIST) {
pa_strbuf_puts(buf, "Module already loaded; ignoring.\n");
} else {
pa_strbuf_puts(buf, "Module load failed.\n");
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6c77b0191a6be390cc1cef2f7da7ba202ab86a92
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6c77b0191a6be390cc1cef2f7da7ba202ab86a92
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20240405/33f07b00/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list