Add an internal variable to mark the FD as "not owned" by the
virNetSocket, in case the internal implementation takes the actual
ownership of the descriptor; this avoids a warning when closing the
socket, as the FD would be invalid.
pid_t pid;
int errfd;
bool client;
+ bool ownsFd;
/* Event callback fields */
virNetSocketIOFunc func;
sock->errfd = errfd;
sock->pid = pid;
sock->watch = -1;
+ sock->ownsFd = true;
/* Disable nagle for TCP sockets */
if (sock->localAddr.data.sa.sa_family == AF_INET ||
virObjectUnref(sock->sshSession);
#endif
- VIR_FORCE_CLOSE(sock->fd);
+ if (sock->ownsFd)
+ VIR_FORCE_CLOSE(sock->fd);
VIR_FORCE_CLOSE(sock->errfd);
virProcessAbort(sock->pid);