summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-08-19 16:27:28 -0600
committerRich Megginson <rmeggins@redhat.com>2010-08-31 10:36:01 -0600
commitd48a2c94731a25fc63a294e854b76bedfd0ced22 (patch)
tree3cb3ae580040a7ec18749256e80a891d6202ecfa
parent74b655b434144e2aa30c86df1e9ec801839ffe28 (diff)
downloadds-d48a2c94731a25fc63a294e854b76bedfd0ced22.tar.gz
ds-d48a2c94731a25fc63a294e854b76bedfd0ced22.tar.xz
ds-d48a2c94731a25fc63a294e854b76bedfd0ced22.zip
openldap_read_function needs to set EWOULDBLOCK if the buffer is empty
If the openldap_read_function has returned all of the buffered data, it needs to set errno to EWOULDBLOCK to let the code know that it needs to read more data into the buffer.
-rw-r--r--ldap/servers/slapd/connection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 4de41f26..587f422d 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -1569,6 +1569,14 @@ openldap_read_function(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
if (bytes_to_copy <= 0) {
bytes_to_copy = 0; /* never return a negative result */
+ /* in this case, we don't have enough data to satisfy the
+ caller, so we have to let it know we need more */
+#if defined(EWOULDBLOCK)
+ errno = EWOULDBLOCK;
+#elif defined(EAGAIN)
+ errno = EAGAIN;
+#endif
+ PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
} else {
/* copy buffered data into output buf */
SAFEMEMCPY(buf, readbuf + offset, bytes_to_copy);