]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virnetsocket: use new API for uniform child cleanup
authorEric Blake <eblake@redhat.com>
Tue, 12 Jul 2011 18:09:43 +0000 (12:09 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 14 Jul 2011 18:02:25 +0000 (12:02 -0600)
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

index 41d9954e6629ea39d85228be3c336debc01f6a8c..7ea1ab7720294de0cd8ef29df56112d85247a677 100644 (file)
@@ -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);