diff options
author | jan <jan@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2005-03-15 11:54:26 +0000 |
---|---|---|
committer | jan <jan@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2005-03-15 11:54:26 +0000 |
commit | 97f68580d716f6d9b58549f9badc350496bc90f4 (patch) | |
tree | ee2ddbeded288967da4f43d6487fd761c88bae16 | |
parent | f3c62d93dff1be3a0382772c70cb20e6e665c6fb (diff) | |
download | lighttpd-97f68580d716f6d9b58549f9badc350496bc90f4.tar.gz |
handle return codes correctly
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/post-upload-cleanup@151 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | src/network_write.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/network_write.c b/src/network_write.c index a6bce8c6..487dda24 100644 --- a/src/network_write.c +++ b/src/network_write.c @@ -94,9 +94,21 @@ network_t network_write_chunkqueue_write(server *srv, file_descr *write_fd, chun toSend = c->data.mem->used - 1 - c->offset; if ((r = write(write_fd->fd, offset, toSend)) < 0) { - log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed: ", strerror(errno), write_fd->fd); + switch (errno) { + case EAGAIN: + write_fd->is_writable = 0; + case EINTR: + r = 0; + break; + case EPIPE: + case ECONNRESET: + return NETWORK_REMOTE_CLOSE; + default: + log_error_write(srv, __FILE__, __LINE__, "ssd", + "write failed:", strerror(errno), write_fd->fd); - return NETWORK_ERROR; + return NETWORK_ERROR; + } } c->offset += r; |