[dovecot-cvs] dovecot/src/lib ostream-file.c,1.48,1.49
cras at dovecot.org
cras at dovecot.org
Wed May 25 14:40:05 EEST 2005
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv11845/src/lib
Modified Files:
ostream-file.c
Log Message:
Don't forget o_stream_set_flush_pending() call if it's called in flush
callback which returns 1.
Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- ostream-file.c 26 Apr 2005 11:08:16 -0000 1.48
+++ ostream-file.c 25 May 2005 11:39:57 -0000 1.49
@@ -349,6 +349,12 @@
struct file_ostream *fstream = context;
int ret;
+ /* Set flush_pending = FALSE first before calling the flush callback,
+ and change it to TRUE only if callback returns 0. That way the
+ callback can call o_stream_set_flush_pending() again and we don't
+ forget it even if flush callback returns 1. */
+ fstream->flush_pending = FALSE;
+
o_stream_ref(&fstream->ostream.ostream);
if (fstream->ostream.callback != NULL)
ret = fstream->ostream.callback(fstream->ostream.context);
@@ -360,7 +366,8 @@
io_remove(fstream->io);
fstream->io = NULL;
}
- fstream->flush_pending = ret <= 0;
+ if (ret == 0)
+ fstream->flush_pending = TRUE;
o_stream_unref(&fstream->ostream.ostream);
}
More information about the dovecot-cvs
mailing list