[dovecot-cvs] dovecot/src/lib-settings settings.c, 1.13.2.1, 1.13.2.2
tss at dovecot.org
tss at dovecot.org
Mon Oct 16 12:12:41 UTC 2006
Update of /var/lib/cvs/dovecot/src/lib-settings
In directory talvi:/tmp/cvs-serv20931
Modified Files:
Tag: branch_1_0
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.13.2.1
retrieving revision 1.13.2.2
diff -u -d -r1.13.2.1 -r1.13.2.2
--- settings.c 10 May 2006 07:36:13 -0000 1.13.2.1
+++ settings.c 16 Oct 2006 11:12:39 -0000 1.13.2.2
@@ -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