1From f82f8faf9942f51e9c3c773b56574652695bef5a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 May 2018 21:45:38 -0700
4Subject: [PATCH] Disable new gcc8 warnings
5
6GCC seems to be not able to detect the checks for size are
7already in place
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11---
12Upstream-Status: Pending
13
14 src/libcollectdclient/network_parse.c | 7 +++++++
15 src/write_sensu.c                     | 7 +++++++
16 2 files changed, 14 insertions(+)
17
18diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c
19index aa753ce..fef43a9 100644
20--- a/src/libcollectdclient/network_parse.c
21+++ b/src/libcollectdclient/network_parse.c
22@@ -148,6 +148,11 @@ static int parse_int(void *payload, size_t payload_size, uint64_t *out) {
23   return 0;
24 }
25
26+#pragma GCC diagnostic push
27+#if __GNUC__ == 8
28+#pragma GCC diagnostic ignored "-Wstringop-truncation"
29+#endif
30+
31 static int parse_string(void *payload, size_t payload_size, char *out,
32                         size_t out_size) {
33   char *in = payload;
34@@ -160,6 +165,8 @@ static int parse_string(void *payload, size_t payload_size, char *out,
35   return 0;
36 }
37
38+#pragma GCC diagnostic pop
39+
40 static int parse_identifier(uint16_t type, void *payload, size_t payload_size,
41                             lcc_value_list_t *state) {
42   char buf[LCC_NAME_LEN];
43diff --git a/src/write_sensu.c b/src/write_sensu.c
44index bd7a56d..6cb59d5 100644
45--- a/src/write_sensu.c
46+++ b/src/write_sensu.c
47@@ -570,6 +570,11 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
48   return ret_str;
49 } /* }}} char *sensu_value_to_json */
50
51+#pragma GCC diagnostic push
52+#if __GNUC__ > 7
53+#pragma GCC diagnostic ignored "-Wstringop-overflow"
54+#pragma GCC diagnostic ignored "-Wstringop-truncation"
55+#endif
56 /*
57  * Uses replace_str2() implementation from
58  * http://creativeandcritical.net/str-replace-c/
59@@ -632,6 +637,8 @@ static char *replace_str(const char *str, const char *old, /* {{{ */
60   return ret;
61 } /* }}} char *replace_str */
62
63+#pragma GCC diagnostic pop
64+
65 static char *replace_json_reserved(const char *message) /* {{{ */
66 {
67   char *msg = replace_str(message, "\\", "\\\\");
68