[core] always lseek() with shared fd

always lseek() with shared fd; remove optim to skip with offset = 0
This commit is contained in:
Glenn Strauss 2020-10-20 10:55:08 -04:00
parent 019c513819
commit 1b74c50854
2 changed files with 2 additions and 2 deletions

View File

@ -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 */

View File

@ -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;