From 831974a762b890982e17bc641253ebaf8df4444d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Feb 2011 14:59:39 +0100 Subject: s3: Slightly simplify winbind_write_sock Autobuild-User: Volker Lendecke Autobuild-Date: Thu Feb 10 17:00:46 CET 2011 on sn-devel-104 --- nsswitch/wb_common.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'nsswitch/wb_common.c') 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; -- cgit