Simon Josefsson <[email protected]> ha escrit:
> if (len == 0)
> {
> imap4d_bye (ERR_NO_IFILE);
> /*FIXME rc = ECONNABORTED;*/
> }
>
> This seems wrong -- sometimes (as in the example above) the expected
> data from the client can be zero-size.
Actually, that was because mu_stream_sequential_readline is expected
to read at least one byte, i.e. '\n'. If it returns 0 bytes, it
means it hit EOF. But the test should definitely go before calling
util_trim_nl, which further modifies len. So, I'd rather propose
this:
diff --git a/imap4d/util.c b/imap4d/util.c
index 8350de0..076d524 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -1375,6 +1375,12 @@ imap4d_getline (char **pbuf, size_t *psize, size_t
*pnbytes)
if (rc == 0)
{
char *s = *pbuf;
+
+ if (len == 0)
+ {
+ imap4d_bye (ERR_NO_IFILE);
+ /*FIXME rc = ECONNABORTED;*/
+ }
len = util_trim_nl (s, len);
if (imap4d_transcript)
{
@@ -1383,11 +1389,6 @@ imap4d_getline (char **pbuf, size_t *psize, size_t
*pnbytes)
else
mu_diag_output (MU_DIAG_DEBUG, "got EOF");
}
- if (len == 0)
- {
- imap4d_bye (ERR_NO_IFILE);
- /*FIXME rc = ECONNABORTED;*/
- }
if (pnbytes)
*pnbytes = len;
}
Can you test if it works for you?
Regards,
Sergey
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils