[dovecot-cvs] dovecot/src/lib-settings settings.c,1.14,1.15
tss at dovecot.org
tss at dovecot.org
Mon Oct 16 12:12:43 UTC 2006
Update of /var/lib/cvs/dovecot/src/lib-settings
In directory talvi:/tmp/cvs-serv20927
Modified Files:
settings.c
Log Message:
Handle the last line even if it doesn't end with LF.
Index: settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-settings/settings.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- settings.c 10 May 2006 07:36:13 -0000 1.14
+++ settings.c 16 Oct 2006 11:12:40 -0000 1.15
@@ -87,7 +87,20 @@
linenum = 0; sections = 0; root_section = 0; errormsg = NULL;
input = i_stream_create_file(fd, default_pool, 2048, TRUE);
- while ((line = i_stream_read_next_line(input)) != NULL) {
+ for (;;) {
+ line = i_stream_read_next_line(input);
+ if (line == NULL) {
+ /* EOF. Also handle the last line even if it doesn't
+ contain LF. */
+ const unsigned char *data;
+ size_t size;
+
+ data = i_stream_get_data(input, &size);
+ if (size == 0)
+ break;
+ line = t_strdup_noconst(t_strndup(data, size));
+ i_stream_skip(input, size);
+ }
linenum++;
/* @UNSAFE: line is modified */
More information about the dovecot-cvs
mailing list