[Dovecot] problem with i_stream_next_line()
Giorgenes Gelatti
giorgenes at gmail.com
Wed Nov 5 14:42:55 EET 2008
Ok. I've made a new patch in the subscription-file.c to fix my problem.
Attached...
thank you
2008/11/4 Timo Sirainen <tss at iki.fi>
> It's not a good idea to change the code that way. For example
> dovecot-uidlist reading relies on i_stream_next_line() not returning a
> partially written. That's why the API description also says:
>
> /* Gets the next line from stream and returns it, or NULL if more data is
> needed to make a full line. Note that if the stream ends with LF not
> being
> the last character, this function doesn't return the last line. */
> char *i_stream_next_line(struct istream *stream);
>
> I'd think the easiest way would be for you to just add the missing LFs to
> the subscription files. Or alternatively change the subscription file
> reading code to also include the last line (with i_stream_get_data() after
> i_stream_next_line() has returned NULL).
>
>
> On Nov 4, 2008, at 10:36 PM, Giorgenes Gelatti wrote:
>
> I did the patch below and it worked for me.
>>
>> diff --git a/dovecot/src/lib/istream.c b/dovecot/src/lib/istream.c
>> index 4b218b9..b195b4f 100644
>> --- a/dovecot/src/lib/istream.c
>> +++ b/dovecot/src/lib/istream.c
>> @@ -245,6 +245,10 @@ char *i_stream_next_line(struct istream *stream)
>> }
>> }
>>
>> + if(ret_buf == NULL && i == _stream->pos) {
>> + ret_buf = i_stream_next_line_finish(_stream, i);
>> + }
>> +
>> return ret_buf;
>>
>>
>> 2008/11/4 Giorgenes Gelatti <giorgenes at gmail.com>
>>
>> Hello there,
>>>
>>> I have a "subscriptions" file that is *not* ended with a line break
>>> (created by another system).
>>> When I do a "lsub "" "*"" the last mailbox name is not listed.
>>> Debugging a little showed that it looks like i_stream_next_line() is not
>>> returning the last line if it doesn't end with a line break.
>>>
>>> Is this a bug?
>>>
>>> btw, i'm using version 1.1.6.
>>>
>>> []'s
>>>
>>>
>>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subscription-file.c.diff
Type: text/x-diff
Size: 1213 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20081105/08e31a11/attachment.bin
More information about the dovecot
mailing list