[libvirt] [PATCH 3/3] virnetsocket: use new API for uniform child cleanup

Eric Blake eblake at redhat.com
Tue Jul 12 19:36:51 UTC 2011


Rather than trying to clean up the ssh child ourselves, and risk
subtle differences from the socket creation error path, we can
just use the new APIs.

* src/rpc/virnetsocket.c (virNetSocketFree): Use new function.
---
 src/rpc/virnetsocket.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)

diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 41d9954..7ea1ab7 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -652,18 +652,7 @@ void virNetSocketFree(virNetSocketPtr sock)
     VIR_FORCE_CLOSE(sock->fd);
     VIR_FORCE_CLOSE(sock->errfd);

-#ifndef WIN32
-    if (sock->pid > 0) {
-        pid_t reap;
-        kill(sock->pid, SIGTERM);
-        do {
-retry:
-            reap = waitpid(sock->pid, NULL, 0);
-            if (reap == -1 && errno == EINTR)
-                goto retry;
-        } while (reap != -1 && reap != sock->pid);
-    }
-#endif
+    virPidAbort(sock->pid);

     VIR_FREE(sock->localAddrStr);
     VIR_FREE(sock->remoteAddrStr);
-- 
1.7.4.4




More information about the libvir-list mailing list