Commit abfc96df authored by Niels Möller's avatar Niels Möller
Browse files

Changed handling of LSH_CLOSE and LSH_DIE.

Rev: src/io.c:1.19
parent 7acbee3d
......@@ -260,6 +260,10 @@ static int io_iter(struct io_backend *b)
/* NOTE: These flags are not mutually exclusive. All
* combination must be handled correctly. */
/* NOTE: (i) If LSH_DIE is set, LSH_CLOSE is ignored.
* (ii) If the fd is read_only, LSH_CLOSE is the same as LSH_DIE.
*/
#if 0
if ( (res & (LSH_CLOSE | LSH_DIE)) == (LSH_CLOSE | LSH_DIE) )
{
debug("return code %x, both LSH_CLOSE and LSH_DIE set.\n",
......@@ -270,14 +274,7 @@ static int io_iter(struct io_backend *b)
/* FIXME: Perhaps we should always set LSH_FAIL in
* this case? */
}
if (res & LSH_CLOSE)
{
if (fd->buffer)
write_buffer_close(fd->buffer);
fd->close_reason
= LSH_FAILUREP(res) ? CLOSE_PROTOCOL_FAILURE : CLOSE_EOF;
}
#endif
if (res & LSH_DIE)
{
if (fd->buffer)
......@@ -287,6 +284,16 @@ static int io_iter(struct io_backend *b)
? CLOSE_PROTOCOL_FAILURE : 0;
fd->close_now = 1;
}
else if (res & LSH_CLOSE)
{
if (fd->buffer)
write_buffer_close(fd->buffer);
else
fd->close_now = 1;
fd->close_reason
= LSH_FAILUREP(res) ? CLOSE_PROTOCOL_FAILURE : CLOSE_EOF;
}
if (res & LSH_KILL_OTHERS)
{
/* Close all other files. We have probably fork()ed. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment