diff options
author | Zhao Liu <zhao1.liu@intel.com> | 2024-07-17 00:23:51 +0800 |
---|---|---|
committer | Konstantin Kostiuk <kkostiuk@redhat.com> | 2024-07-19 11:52:25 +0300 |
commit | 1d523869d71aa5e4e17f652c04628ee8432bb8d2 (patch) | |
tree | d81ab4ead24efe73620c5f3caa68a76c1873f447 /qga | |
parent | 2e3b166c41e20eba7e74d9a9203a663cc455bc49 (diff) |
qga/commands-posix: Make ga_wait_child() return boolean
Make ga_wait_child() return boolean and check the returned boolean
in ga_run_command() instead of dereferencing @errp.
Cc: Michael Roth <michael.roth@amd.com>
Cc: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Message-ID: <20240716162351.270095-1-zhao1.liu@intel.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Diffstat (limited to 'qga')
-rw-r--r-- | qga/commands-posix.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 578d29f228..c2bd0b4316 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -48,7 +48,7 @@ #endif #endif -static void ga_wait_child(pid_t pid, int *status, Error **errp) +static bool ga_wait_child(pid_t pid, int *status, Error **errp) { pid_t rpid; @@ -59,10 +59,11 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) if (rpid == -1) { error_setg_errno(errp, errno, "failed to wait for child (pid: %d)", pid); - return; + return false; } g_assert(rpid == pid); + return true; } static ssize_t ga_pipe_read_str(int fd[2], char **str) @@ -167,8 +168,7 @@ static int ga_run_command(const char *argv[], const char *in_str, goto out; } - ga_wait_child(pid, &status, errp); - if (*errp) { + if (!ga_wait_child(pid, &status, errp)) { goto out; } |