summaryrefslogtreecommitdiff
path: root/nsswitch/wb_common.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /nsswitch/wb_common.c
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2
samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'nsswitch/wb_common.c')
-rw-r--r--nsswitch/wb_common.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index dcfc8a5156..80c729a3b6 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -369,13 +369,14 @@ static int winbind_open_pipe_sock(int recursing, int need_priv)
static int winbind_write_sock(void *buffer, int count, int recursing,
int need_priv)
{
- int result, nwritten;
+ int fd, result, nwritten;
/* Open connection to winbind daemon */
restart:
- if (winbind_open_pipe_sock(recursing, need_priv) == -1) {
+ fd = winbind_open_pipe_sock(recursing, need_priv);
+ if (fd == -1) {
errno = ENOENT;
return -1;
}
@@ -391,7 +392,7 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
/* Catch pipe close on other end by checking if a read()
call would not block by calling poll(). */
- pfd.fd = winbindd_fd;
+ pfd.fd = fd;
pfd.events = POLLIN|POLLHUP;
ret = poll(&pfd, 1, 0);
@@ -412,8 +413,7 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
/* Do the write */
- result = write(winbindd_fd,
- (char *)buffer + nwritten,
+ result = write(fd, (char *)buffer + nwritten,
count - nwritten);
if ((result == -1) || (result == 0)) {
@@ -434,10 +434,12 @@ static int winbind_write_sock(void *buffer, int count, int recursing,
static int winbind_read_sock(void *buffer, int count)
{
+ int fd;
int nread = 0;
int total_time = 0;
- if (winbindd_fd == -1) {
+ fd = winbind_open_pipe_sock(false, false);
+ if (fd == -1) {
return -1;
}
@@ -449,7 +451,7 @@ static int winbind_read_sock(void *buffer, int count)
/* Catch pipe close on other end by checking if a read()
call would not block by calling poll(). */
- pfd.fd = winbindd_fd;
+ pfd.fd = fd;
pfd.events = POLLIN|POLLHUP;
/* Wait for 5 seconds for a reply. May need to parameterise this... */
@@ -475,7 +477,7 @@ static int winbind_read_sock(void *buffer, int count)
/* Do the Read */
- int result = read(winbindd_fd, (char *)buffer + nread,
+ int result = read(fd, (char *)buffer + nread,
count - nread);
if ((result == -1) || (result == 0)) {