From 128f4f70c67071351e7d1312bc762978fc2d0bcb Mon Sep 17 00:00:00 2001 From: jcid Date: Wed, 5 Dec 2007 16:39:22 +0100 Subject: Added a workaround for a CCC reentrancy segfault. --- src/IO/IO.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/IO/IO.c') diff --git a/src/IO/IO.c b/src/IO/IO.c index 5e984ed8..335b4378 100644 --- a/src/IO/IO.c +++ b/src/IO/IO.c @@ -158,6 +158,7 @@ static bool_t IO_read(IOData_t *io) char Buf[IOBufLen]; ssize_t St; bool_t ret = FALSE; + int io_key = io->Key; DEBUG_MSG(3, " IO_read\n"); @@ -190,8 +191,14 @@ static bool_t IO_read(IOData_t *io) a_IO_ccc(OpSend, 2, FWD, io->Info, io, NULL); } if (St == 0) { - /* All data read (EOF) */ - a_IO_ccc(OpEnd, 2, FWD, io->Info, io, NULL); + /* TODO: design a general way to avoid reentrancy problems with CCC. */ + + /* The following check is necessary because the above CCC operation + * may abort the whole Chain. */ + if ((io = IO_get(io_key))) { + /* All data read (EOF) */ + a_IO_ccc(OpEnd, 2, FWD, io->Info, io, NULL); + } } return ret; } -- cgit v1.2.3