[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/25] qga/commands-posix: Make ga_wait_child() return boolean
From: |
Konstantin Kostiuk |
Subject: |
[PULL 23/25] qga/commands-posix: Make ga_wait_child() return boolean |
Date: |
Mon, 22 Jul 2024 10:01:20 +0300 |
From: Zhao Liu <zhao1.liu@intel.com>
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>
---
qga/commands-posix.c | 8 ++++----
1 file 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;
}
--
2.45.2
- [PULL 09/25] qga: conditionalize schema for commands unsupported on non-Linux POSIX, (continued)
- [PULL 09/25] qga: conditionalize schema for commands unsupported on non-Linux POSIX, Konstantin Kostiuk, 2024/07/22
- [PULL 13/25] qga: conditionalize schema for commands requiring fsfreeze, Konstantin Kostiuk, 2024/07/22
- [PULL 16/25] qga: conditionalize schema for commands requiring utmpx, Konstantin Kostiuk, 2024/07/22
- [PULL 20/25] qga: remove pointless 'blockrpcs_key' variable, Konstantin Kostiuk, 2024/07/22
- [PULL 10/25] qga: conditionalize schema for commands requiring getifaddrs, Konstantin Kostiuk, 2024/07/22
- [PULL 14/25] qga: conditionalize schema for commands requiring fstrim, Konstantin Kostiuk, 2024/07/22
- [PULL 18/25] qga: don't disable fsfreeze commands if vss_init fails, Konstantin Kostiuk, 2024/07/22
- [PULL 25/25] qga/linux: Add new api 'guest-network-get-route', Konstantin Kostiuk, 2024/07/22
- [PULL 24/25] guest-agent: document allow-rpcs in config file section, Konstantin Kostiuk, 2024/07/22
- [PULL 19/25] qga: move declare of QGAConfig struct to top of file, Konstantin Kostiuk, 2024/07/22
- [PULL 23/25] qga/commands-posix: Make ga_wait_child() return boolean,
Konstantin Kostiuk <=
- Re: [PULL 00/25] Misc QEMU-GA patches 2024-07-22, Richard Henderson, 2024/07/22