From: Laurent Vivier <lviv...@redhat.com>

If g_remove() fails, use warn_report() to log an error.

Signed-off-by: Laurent Vivier <lviv...@redhat.com>
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Jason Wang <jasow...@redhat.com>
---
 net/passt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/passt.c b/net/passt.c
index ef59d0682b..43c336e596 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.42.0


Reply via email to