From: Jaroslav Kysela Date: Tue, 13 Apr 2021 07:52:35 +0000 (+0200) Subject: ucm: handle better the system() call X-Git-Tag: v1.2.5~60 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=7e4390137af6d7d546454368019ff3213f56fd1b;p=alsa-lib.git ucm: handle better the system() call Signed-off-by: Jaroslav Kysela --- diff --git a/src/ucm/main.c b/src/ucm/main.c index 385ee5e8..18531c80 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -713,8 +713,18 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr, break; case SEQUENCE_ELEMENT_TYPE_EXEC: err = system(s->data.exec); - if (err < 0) + if (WIFSIGNALED(err)) { + err = -EINTR; + } if (WIFEXITED(err)) { + if (WEXITSTATUS(err) != 0) { + uc_error("command '%s' failed (exit code %d)", s->data.exec, WEXITSTATUS(err)); + err = -EINVAL; + goto __fail; + } + } else if (err < 0) { + err = -errno; goto __fail; + } break; case SEQUENCE_ELEMENT_TYPE_CMPT_SEQ: /* Execute enable or disable sequence of a component