qga/commands-posix: Make ga_wait_child() return boolean
PATCH v2 1/1 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.
---
v2:
* Added Phil's r/b.
* Used Phil's polished words.
--- qga/commands-posix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
qga/commands-posix.c +4 -4
@@ -59,7 +59,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;
@@ -70,10 +70,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)
@@ -178,8 +179,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; }
Signature · 1 line
2.34.1
Hi Konstantin,
If there are no other patches on your guest-agent queue, I can take this patch in my next pull request.
Regards,
Phil.
Quoted 51 lines · Zhao Liu
Make
ga_wait_child()return boolean and check the returned boolean inga_run_command()instead of dereferencing @errp.Cc Michael Roth <[email protected]>Cc Konstantin Kostiuk <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Zhao Liu <[email protected]>---
v2:
* Added Phil's r/b.
* Used Phil's polished words.--- qga/commands-posix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)qga/commands-posix.c +4
-4@@ -59,7 +59,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;@@ -70,10 +70,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)@@ -178,8 +179,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; }
Konstantin Kostiuk
Reviewed-byHi Philippe,
I plan to merge this with "Add new api 'guest-network-get-route'"
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/
Can I ask you to review the new GuestNetworkRoute struct with IPv6 support?
Quoted 66 lines · Philippe Mathieu-Daudé
Hi Konstantin,
If there are no other patches on your guest-agent queue, I can take this patch in my next pull request.
Regards,
Phil.
qga/commands-posix.c static void ga_wait_child(pid_t pid, int *status,
Quoted 29 lines · Zhao Liu
Make
ga_wait_child()return boolean and check the returned boolean inga_run_command()instead of dereferencing @errp.Cc Michael Roth <[email protected]>Cc Konstantin Kostiuk <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Zhao Liu <[email protected]>---
v2:
* Added Phil's r/b.
* Used Phil's polished words.--- qga/commands-posix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)qga/commands-posix.c +1
-1@@ -59,7 +59,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;@@ -70,10 +70,11 @@ static void ga_wait_child(pid_t pid, int *status,Error **errp)
qga/commands-posix.c static void ga_wait_child(pid_t pid, int *status, · line 71
Quoted 2 lines
qga/commands-posix.c +0
-0if (rpid ==-1 ) { error_setg_errno(errp, errno, "failed to wait for child (pid:%d)",
qga/commands-posix.c static int ga_run_command(const char *argv[], const
Quoted 11 lines
qga/commands-posix.c +2
-1pid); -return ; +return false; }g_assert (rpid == pid); +return true; }static ssize_t ga_pipe_read_str (int fd[2 ],char **str)@@ -178,8 +179,7 @@ static int ga_run_command(const char *argv[], constchar
*in_str,Quoted 9 lines
qga/commands-posix.c +1
-2goto out; } -ga_wait_child (pid, &status, errp); -if (*errp) { +if (!ga_wait_child (pid, &status, errp)) { goto out; }