]> git.kaiwu.me - nginx.git/commitdiff
Core: fixed errno clobbering in ngx_sendmsg().
authorVladimir Homutov <vl@nginx.com>
Tue, 20 Jul 2021 09:04:58 +0000 (12:04 +0300)
committerVladimir Homutov <vl@nginx.com>
Tue, 20 Jul 2021 09:04:58 +0000 (12:04 +0300)
This was broken by 2dfd313f22f2.

src/os/unix/ngx_udp_sendmsg_chain.c

index 78b497ea0efee44e8c79a37b2132289477173305..b29b8d3185593ef87757d5aac2fdbbbe42cf61f0 100644 (file)
@@ -398,15 +398,6 @@ eintr:
 
     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;
 
@@ -428,5 +419,14 @@ eintr:
         }
     }
 
+#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;
 }