nsswitch: Fix short writes in winbind_write_sock
authorVolker Lendecke <vl@samba.org>
Tue, 15 Oct 2013 08:23:10 +0000 (08:23 +0000)
committerKarolin Seeger <kseeger@samba.org>
Mon, 28 Oct 2013 10:01:01 +0000 (11:01 +0100)
We set the socket to nonblocking and don't handle EAGAIN right. We do
a poll anyway, so wait for writability, which should fix this.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10195
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit c6909887c26d4e827633acd50b11cf08c6aee0f7)
Signed-off-by: Andreas Schneider <asn@samba.org>
nsswitch/wb_common.c

index dcfc8a5156886e63cacd1b103f466ebc7e34833a..3ba2bb5b2b097661ee2acb92b07c8288ececfbf8 100644 (file)
@@ -392,9 +392,9 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
                   call would not block by calling poll(). */
 
                pfd.fd = winbindd_fd;
-               pfd.events = POLLIN|POLLHUP;
+               pfd.events = POLLIN|POLLOUT|POLLHUP;
 
-               ret = poll(&pfd, 1, 0);
+               ret = poll(&pfd, 1, -1);
                if (ret == -1) {
                        winbind_close_sock();
                        return -1;                   /* poll error */