summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_application.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-07-23 14:24:55 +0300
committerMax Romanov <max.romanov@nginx.com>2020-07-23 14:24:55 +0300
commit137c1e736f4572198929ecd4f7e88a2586224650 (patch)
treea08fb46934acc2630446feea7d64b7bcd4e07a96 /src/nxt_application.c
parentfa696569f9e2c8d3d286eb14891c0adc797200d8 (diff)
downloadunit-137c1e736f4572198929ecd4f7e88a2586224650.tar.gz
unit-137c1e736f4572198929ecd4f7e88a2586224650.tar.bz2
Fixing main and application port structs file descriptor init.
Correct value for non-initialized file descriptor is -1, because most of the checks in libunit compares file descriptor with -1 before performing an action. Using 0 as default value, may cause to close file descriptor #0, this may affect application logic. It is not required to list this patch in changelog because impact is not seen by end users.
Diffstat (limited to 'src/nxt_application.c')
-rw-r--r--src/nxt_application.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 834badf9..c331764f 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -1282,6 +1282,7 @@ nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init)
init->ready_port.id.pid = main_port->pid;
init->ready_port.id.id = main_port->id;
+ init->ready_port.in_fd = -1;
init->ready_port.out_fd = main_port->pair[1];
nxt_fd_blocking(task, main_port->pair[1]);
@@ -1291,6 +1292,7 @@ nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init)
init->read_port.id.pid = my_port->pid;
init->read_port.id.id = my_port->id;
init->read_port.in_fd = my_port->pair[0];
+ init->read_port.out_fd = -1;
nxt_fd_blocking(task, my_port->pair[0]);