diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-20 10:55:08 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-20 11:51:48 -0400 |
commit | 1b74c50854c5406b186479a611001a34ab3c8b25 (patch) | |
tree | 5dc14f0c52c99572a247e8f87e348b7f313043cf | |
parent | 019c513819c829af038bdec93a7c4c0cb3f687b7 (diff) | |
download | lighttpd-git-1b74c50854c5406b186479a611001a34ab3c8b25.tar.gz |
[core] always lseek() with shared fd
always lseek() with shared fd; remove optim to skip with offset = 0
-rw-r--r-- | src/chunk.c | 2 | ||||
-rw-r--r-- | src/http_chunk.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/chunk.c b/src/chunk.c index f9d8a96f..bb5a7925 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -882,7 +882,7 @@ chunkqueue_small_resp_optim (chunkqueue * const restrict cq) const int fd = filec->file.fd; if (fd < 0) return; /*(require that file already be open)*/ off_t offset = filec->offset; - if (0 != offset && -1 == lseek(fd, offset, SEEK_SET)) return; + if (-1 == lseek(fd, offset, SEEK_SET)) return; /* Note: there should be no size change in chunkqueue, * so cq->bytes_in and cq->bytes_out should not be modified */ diff --git a/src/http_chunk.c b/src/http_chunk.c index d606ba83..f55936b1 100644 --- a/src/http_chunk.c +++ b/src/http_chunk.c @@ -76,7 +76,7 @@ static int http_chunk_append_read_fd_range(request_st * const r, const buffer * if (r->resp_send_chunked) http_chunk_len_append(cq, (uintmax_t)len); - if (0 != offset && -1 == lseek(fd, offset, SEEK_SET)) return -1; + if (-1 == lseek(fd, offset, SEEK_SET)) return -1; buffer * const b = chunkqueue_append_buffer_open_sz(cq, len+2+1); ssize_t rd; offset = 0; |