summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-10-02 19:49:49 +0300
committerMax Romanov <max.romanov@nginx.com>2018-10-02 19:49:49 +0300
commit141ee2aa326d54eeecc2ef96f61e2d2d8068b6b1 (patch)
treec57e5b07699cf0989625fe27e2d8f111de67baea
parentc8b30ef4da02278308e0ed050d9a937134a6aa45 (diff)
downloadunit-141ee2aa326d54eeecc2ef96f61e2d2d8068b6b1.tar.gz
unit-141ee2aa326d54eeecc2ef96f61e2d2d8068b6b1.tar.bz2
Filling cmsghdr with 0 to pass Go 1.11 message validation.
-rw-r--r--src/nxt_unit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index 251c5219..0d1be557 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -2167,9 +2167,12 @@ nxt_unit_send_mmap(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id, int fd)
msg.mf = 0;
msg.tracking = 0;
-#if (NXT_VALGRIND)
+ /*
+ * Fill all padding fields with 0.
+ * Code in Go 1.11 validate cmsghdr using padding field as part of len.
+ * See Cmsghdr definition and socketControlMessageHeaderAndData function.
+ */
memset(&cmsg, 0, sizeof(cmsg));
-#endif
cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.cm.cmsg_level = SOL_SOCKET;
@@ -3001,9 +3004,7 @@ nxt_unit_send_port(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *dst,
m.new_port.max_size = 16 * 1024;
m.new_port.max_share = 64 * 1024;
-#if (NXT_VALGRIND)
memset(&cmsg, 0, sizeof(cmsg));
-#endif
cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.cm.cmsg_level = SOL_SOCKET;