]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
ctl: don't use C99 designated initializer for structs to travel on a socket
authorVincent Bernat <vincent@bernat.im>
Wed, 20 May 2015 18:25:32 +0000 (20:25 +0200)
committerVincent Bernat <vincent@bernat.im>
Wed, 20 May 2015 18:25:32 +0000 (20:25 +0200)
While this is harmless, we prefer to know that each byte is correctly
initialized to avoid Valgrind warnings.

src/ctl.c

index 5799f1d6325d62fedb0a5066fb859f7a6b441025..a347908eaf5e429a1e5fcd71a8ecc5842ef06543 100644 (file)
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -160,10 +160,10 @@ ctl_msg_send_unserialized(uint8_t **output_buffer, size_t *output_len,
                *output_buffer = new;
        }
 
-       struct hmsg_header hdr = {
-               .type = type,
-               .len = len
-       };
+       struct hmsg_header hdr;
+       memset(&hdr, 0, sizeof(struct hmsg_header));
+       hdr.type = type;
+       hdr.len = len;
        memcpy(*output_buffer + *output_len, &hdr, sizeof(struct hmsg_header));
        if (t)
                memcpy(*output_buffer + *output_len + sizeof(struct hmsg_header), buffer, len);