Skip to content

Commit b6db2e7

Browse files
optimize: add error log when closing the pipe failed. (#2050)
1 parent b91221b commit b6db2e7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/ngx_http_lua_pipe.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,21 @@ ngx_http_lua_ffi_pipe_spawn(ngx_http_lua_ffi_pipe_proc_t *proc,
773773
}
774774
}
775775

776-
close(in[0]);
777-
close(out[1]);
776+
if (close(in[0]) == -1) {
777+
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
778+
"lua pipe failed to close the in[0]");
779+
}
780+
781+
if (close(out[1]) == -1) {
782+
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
783+
"lua pipe failed to close the out[1]");
784+
}
785+
778786
if (!merge_stderr) {
779-
close(err[1]);
787+
if (close(err[1]) == -1) {
788+
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
789+
"lua pipe failed to close the err[1]");
790+
}
780791
}
781792

782793
if (environ != NULL) {

0 commit comments

Comments
 (0)