]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
net/passt: Check return value of g_remove() in net_passt_cleanup() (CID 1612369)
authorLaurent Vivier <lvivier@redhat.com>
Thu, 17 Jul 2025 15:08:03 +0000 (17:08 +0200)
committerJason Wang <jasowang@redhat.com>
Mon, 21 Jul 2025 02:22:57 +0000 (10:22 +0800)
If g_remove() fails, use warn_report() to log an error.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/passt.c

index ef59d0682be19179d5dd0782c52984b48f1ba074..43c336e5968c8c1eb15d942eb2ae0a9e0dce50bb 100644 (file)
@@ -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);
 }