diff options
-rw-r--r-- | nsswitch/wb_common.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c index 9a3788a072..ccc5142d9c 100644 --- a/nsswitch/wb_common.c +++ b/nsswitch/wb_common.c @@ -403,31 +403,29 @@ static int winbind_write_sock(void *buffer, int count, int recursing, /* Write should be OK if fd not available for reading */ - if (!FD_ISSET(winbindd_fd, &r_fds)) { + if (FD_ISSET(winbindd_fd, &r_fds)) { - /* Do the write */ + /* Pipe has closed on remote end */ - result = write(winbindd_fd, - (char *)buffer + nwritten, - count - nwritten); + winbind_close_sock(); + goto restart; + } - if ((result == -1) || (result == 0)) { + /* Do the write */ - /* Write failed */ + result = write(winbindd_fd, + (char *)buffer + nwritten, + count - nwritten); - winbind_close_sock(); - return -1; - } - - nwritten += result; + if ((result == -1) || (result == 0)) { - } else { - - /* Pipe has closed on remote end */ + /* Write failed */ winbind_close_sock(); - goto restart; + return -1; } + + nwritten += result; } return nwritten; |