# HG changeset patch # User Timo Sirainen # Date 1383514035 -7200 # Node ID 10c0aae82d0dee0b0107c2262db50d5f6984c181 # Parent 653d5a81a22e73ff91264f7e7277b1c0206574ec ostream: Mark stream closed before handling its callback to avoid infinite loops. The callback could call o_stream_copy_error_from_parent(), which in turn would try to close the same ostream again. diff -r 653d5a81a22e -r 10c0aae82d0d src/lib/ostream.c --- a/src/lib/ostream.c Sun Nov 03 22:04:53 2013 +0200 +++ b/src/lib/ostream.c Sun Nov 03 23:27:15 2013 +0200 @@ -46,8 +46,8 @@ static void o_stream_close_full(struct ostream *stream, bool close_parents) { if (!stream->closed) { + stream->closed = TRUE; io_stream_close(&stream->real_stream->iostream, close_parents); - stream->closed = TRUE; } if (stream->stream_errno == 0)