virnetsocket: use new API for uniform child cleanup

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.
This commit is contained in:
Eric Blake 2011-07-12 12:09:43 -06:00
parent 3cbf5d5f76
commit a59a99f218

View 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);