[PATCH 4/6] net/passt: Check return value of g_remove() in net_passt_cleanup() (CID 1612369)

Laurent Vivier posted 6 patches 4 months ago
Maintainers: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
[PATCH 4/6] net/passt: Check return value of g_remove() in net_passt_cleanup() (CID 1612369)
Posted by Laurent Vivier 4 months ago
If g_remove() fails, use warn_report() to log an error.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 net/passt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/passt.c b/net/passt.c
index ef59d0682be1..43c336e5968c 100644
--- a/net/passt.c
+++ b/net/passt.c
@@ -103,7 +103,10 @@ static void net_passt_cleanup(NetClientState *nc)
 #endif
 
     kill(s->pid, SIGTERM);
-    g_remove(s->pidfile);
+    if (g_remove(s->pidfile) != 0) {
+        warn_report("Failed to remove passt pidfile %s: %s",
+                    s->pidfile, strerror(errno));
+    }
     g_free(s->pidfile);
     g_ptr_array_free(s->args, TRUE);
 }
-- 
2.49.0
Re: [PATCH 4/6] net/passt: Check return value of g_remove() in net_passt_cleanup() (CID 1612369)
Posted by Peter Maydell 3 months, 4 weeks ago
On Thu, 17 Jul 2025 at 18:44, Laurent Vivier <lvivier@redhat.com> wrote:
>
> If g_remove() fails, use warn_report() to log an error.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  net/passt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM