Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Core: fixed errno clobbering in ngx_sendmsg().
Browse files Browse the repository at this point in the history
This was broken by 2dfd313f22f2.
  • Loading branch information
vlhomutov committed Jul 20, 2021
1 parent 2b430d3 commit 340c004
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/os/unix/ngx_udp_sendmsg_chain.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,6 @@ ngx_sendmsg(ngx_connection_t *c, struct msghdr *msg, int flags)

n = sendmsg(c->fd, msg, flags);

#if (NGX_DEBUG)
for (i = 0, size = 0; i < (size_t) msg->msg_iovlen; i++) {
size += msg->msg_iov[i].iov_len;
}

ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
"sendmsg: %z of %uz", n, size);
#endif

if (n == -1) {
err = ngx_errno;

Expand All @@ -428,5 +419,14 @@ ngx_sendmsg(ngx_connection_t *c, struct msghdr *msg, int flags)
}
}

#if (NGX_DEBUG)
for (i = 0, size = 0; i < (size_t) msg->msg_iovlen; i++) {
size += msg->msg_iov[i].iov_len;
}

ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
"sendmsg: %z of %uz", n, size);
#endif

return n;
}

0 comments on commit 340c004

Please sign in to comment.