]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virprocess: Report errno if virProcessAbort() fails
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Sep 2025 11:09:34 +0000 (13:09 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Sep 2025 06:32:14 +0000 (08:32 +0200)
The aim of virProcessAbort() is to reap a child process. It does
so by waitpid()-ing and possibly sending SIGTERM/SIGKILL to the
child process (and waitpid()-ing again). Nevertheless, if
everything fails a debug message is printed. But the message
mentions only the PID and not errno (set by previous waitpid())
which may be useful. For instance when virProcessAbort() is
called over a PID that's not our child:

  failed to reap child 16325, abandoning it: No child processes

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virprocess.c

index 3889ba90f9b9f393542eb85c4a398f6ec2ef0e9f..e8120c1bdcd132e52d4850ac875322e8ad05d5fa 100644 (file)
@@ -168,7 +168,8 @@ virProcessAbort(pid_t pid)
             }
         }
     }
-    VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid);
+    VIR_DEBUG("failed to reap child %lld, abandoning it: %s",
+              (long long) pid, g_strerror(errno));
 
  cleanup:
     errno = saved_errno;