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

* io.h (CLOSE_EOF): Changed the meaning of this constant. Now used

also for EOF on writing.
* io.c (prepare_write): Use the close_reason CLOSE_EOF when a
closed write_buffer has been flushed successfully.

* io.c (write_callback): Report EPIPE and other write failures

Rev: src/io.c:1.36
Rev: src/io.h:1.24
parent 3c508df2
......@@ -324,8 +324,8 @@ static void write_callback(struct lsh_fd *fd)
case EAGAIN:
case EPIPE:
werror("Broken pipe\n");
close_fd(fd, CLOSE_WRITE_FAILED);
debug("io.c: Broken pipe.\n");
close_fd(fd, CLOSE_BROKEN_PIPE);
werror("io.c: write failed, %s\n", strerror(errno));
......@@ -649,7 +649,7 @@ static void prepare_write(struct lsh_fd *fd)
if (! (fd->want_write = write_buffer_pre_write(self->buffer))
&& self->buffer->closed)
close_fd(fd, CLOSE_EOF);
struct abstract_write *io_read_write(struct io_backend *b,
......@@ -50,7 +50,9 @@
/* Close callbacks are called with a reason as argument. */
/* End of file while reading */
/* End of file while reading.
* Or when a closed write_buffer has been flushed successfully. */
/* FIXME: Should we use separate codes for these two events? */
#define CLOSE_EOF 1
/* EPIPE when writing */
Supports Markdown
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