Fix a bug when a child dies when a request is pending in the child. If the signal handler fires before epoll finds out the other end of the parent-child socket is closed, we close the socket on our side without taking care of the pending request. This causes two problems: First, that one pending request never is replied to properly, and secondly, we might end up with EPOLL_DEL on a wrong file descriptor. This causes all sorts of trouble if we hit an active one. The fix for this problem is not to close the socket in winbind_child_died(). This however stops an idle child that dies hard from being properly cleaned up. The fix for that is to add the child->monitor_fde that is set pending only when no child request is active. This way we can remove the close(sock) in the signal handler.
epoll is monitoring descriptors and associated events Signal recieved and signal handler fires(which signal SIGCHLD?) and closes 1 end of named pipe/fifo (may be read or write) And we close other end. Can we reproduce this issue, how? struct winbindd_child { .. int monitor_fde; }; if (no_child_active) monitor_fde=-1; //pending