mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
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:
parent
3cbf5d5f76
commit
a59a99f218
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user