qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] qga/commands-posix: Make ga_wait_child() return boolean
@ 2024-07-16 16:23 Zhao Liu
  2024-07-17 10:25 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Zhao Liu @ 2024-07-16 16:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Zhao Liu, Michael Roth, Konstantin Kostiuk

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>
---
v2:
 * Added Phil's r/b.
 * Used Phil's polished words.
---
 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 7f05996495a2..64bb0be94479 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -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;
     }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] qga/commands-posix: Make ga_wait_child() return boolean
  2024-07-16 16:23 [PATCH v2] qga/commands-posix: Make ga_wait_child() return boolean Zhao Liu
@ 2024-07-17 10:25 ` Philippe Mathieu-Daudé
  2024-07-17 13:12   ` Konstantin Kostiuk
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-17 10:25 UTC (permalink / raw)
  To: Zhao Liu, qemu-devel; +Cc: Michael Roth, Konstantin Kostiuk

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.

On 16/7/24 18:23, Zhao Liu wrote:
> 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>
> ---
> v2:
>   * Added Phil's r/b.
>   * Used Phil's polished words.
> ---
>   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 7f05996495a2..64bb0be94479 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -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;
>       }
>   



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] qga/commands-posix: Make ga_wait_child() return boolean
  2024-07-17 10:25 ` Philippe Mathieu-Daudé
@ 2024-07-17 13:12   ` Konstantin Kostiuk
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Kostiuk @ 2024-07-17 13:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Zhao Liu, Michael Roth, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]

Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

Hi Philippe,

I plan to merge this with "Add new api 'guest-network-get-route'"
https://patchwork.kernel.org/project/qemu-devel/cover/20240613092802.346246-1-demeng@redhat.com/
Can I ask you to review the new GuestNetworkRoute struct with IPv6 support?


On Wed, Jul 17, 2024 at 1:25 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> 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.
>
> On 16/7/24 18:23, Zhao Liu wrote:
> > 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>
> > ---
> > v2:
> >   * Added Phil's r/b.
> >   * Used Phil's polished words.
> > ---
> >   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 7f05996495a2..64bb0be94479 100644
> > --- a/qga/commands-posix.c
> > +++ b/qga/commands-posix.c
> > @@ -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;
> >       }
> >
>
>

[-- Attachment #2: Type: text/html, Size: 3633 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-17 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 16:23 [PATCH v2] qga/commands-posix: Make ga_wait_child() return boolean Zhao Liu
2024-07-17 10:25 ` Philippe Mathieu-Daudé
2024-07-17 13:12   ` Konstantin Kostiuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).