Skip to content

Properly initialise some structures #1591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/nxt_socket_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ nxt_socket_msg_oob_init(nxt_send_oob_t *oob, int *fds)
int nfds;
struct cmsghdr *cmsg;

*oob = (nxt_send_oob_t) {};

#if (NXT_HAVE_MSGHDR_CMSGCRED)
cmsg = (struct cmsghdr *) (oob->buf);
/*
Expand Down
12 changes: 2 additions & 10 deletions src/nxt_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,20 +943,16 @@ nxt_unit_ready(nxt_unit_ctx_t *ctx, int ready_fd, uint32_t stream, int queue_fd)
{
ssize_t res;
nxt_send_oob_t oob;
nxt_port_msg_t msg;
nxt_port_msg_t msg = {};
nxt_unit_impl_t *lib;
int fds[2] = {queue_fd, -1};

lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);

msg.stream = stream;
msg.pid = lib->pid;
msg.reply_port = 0;
msg.type = _NXT_PORT_MSG_PROCESS_READY;
msg.last = 1;
msg.mmap = 0;
msg.nf = 0;
msg.mf = 0;

nxt_socket_msg_oob_init(&oob, fds);

Expand Down Expand Up @@ -3258,7 +3254,7 @@ void
nxt_unit_request_done(nxt_unit_request_info_t *req, int rc)
{
uint32_t size;
nxt_port_msg_t msg;
nxt_port_msg_t msg = {};
nxt_unit_impl_t *lib;
nxt_unit_request_info_impl_t *req_impl;

Expand Down Expand Up @@ -3302,13 +3298,9 @@ nxt_unit_request_done(nxt_unit_request_info_t *req, int rc)

msg.stream = req_impl->stream;
msg.pid = lib->pid;
msg.reply_port = 0;
msg.type = (rc == NXT_UNIT_OK) ? _NXT_PORT_MSG_DATA
: _NXT_PORT_MSG_RPC_ERROR;
msg.last = 1;
msg.mmap = 0;
msg.nf = 0;
msg.mf = 0;

(void) nxt_unit_port_send(req->ctx, req->response_port,
&msg, sizeof(msg), NULL);
Expand Down
Loading