From 0c5bb8a5e10657cec505729596c8b2f0c794cc8f Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Thu, 26 Jun 2025 22:20:46 +0100 Subject: Remove short read checks This removes a bunch of checks for cases where we _read_ less bytes than asked for. There are several reasons why we may _read_ less bytes including reading data from a network file system. This has proven to be an issue. Closes: https://github.com/nginx/nginx/issues/265 Signed-off-by: Andrew Clayton --- src/core/ngx_conf_file.c | 8 -------- src/core/ngx_output_chain.c | 7 ------- 2 files changed, 15 deletions(-) (limited to 'src/core') diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index 197704b0f..cb566dac8 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -593,14 +593,6 @@ ngx_conf_read_token(ngx_conf_t *cf) return NGX_ERROR; } - if (n != size) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - ngx_read_file_n " returned " - "only %z bytes instead of %z", - n, size); - return NGX_ERROR; - } - b->pos = b->start + len; b->last = b->pos + n; start = b->start; diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index a46209c17..078326d56 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -623,13 +623,6 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx) return (ngx_int_t) n; } - if (n != size) { - ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0, - ngx_read_file_n " read only %z of %O from \"%s\"", - n, size, src->file->name.data); - return NGX_ERROR; - } - dst->last += n; if (sendfile) { -- cgit