* Patch to workaraound -Werror=stringop-truncation in GCC 8

Signed-off-by: Jacob Stiffler <[email protected]>
---
 .../0001-gcc8-strncpy-werror-workaround.patch      | 83 ++++++++++++++++++++++
 .../recipes-support/mstpctl/mstpd_git.bb           | 20 ++++++
 2 files changed, 103 insertions(+)
 create mode 100644 
meta-arago-extras/recipes-support/mstpctl/mstpd/0001-gcc8-strncpy-werror-workaround.patch
 create mode 100644 meta-arago-extras/recipes-support/mstpctl/mstpd_git.bb

diff --git 
a/meta-arago-extras/recipes-support/mstpctl/mstpd/0001-gcc8-strncpy-werror-workaround.patch
 
b/meta-arago-extras/recipes-support/mstpctl/mstpd/0001-gcc8-strncpy-werror-workaround.patch
new file mode 100644
index 0000000..21f7e7d
--- /dev/null
+++ 
b/meta-arago-extras/recipes-support/mstpctl/mstpd/0001-gcc8-strncpy-werror-workaround.patch
@@ -0,0 +1,83 @@
+From 8a24d984988bcf832d7684b2a4e9d23b643a433d Mon Sep 17 00:00:00 2001
+From: Djordje Senicic <[email protected]>
+Date: Sun, 14 Apr 2019 05:49:35 -0400
+Subject: [PATCH] gcc8 strncpy werror workaround
+
+Signed-off-by: Djordje Senicic <[email protected]>
+
+Upstream-Status: Inappropriate [other]
+
+HACK to workaround GCC 8 reported error.
+
+---
+ mstp.c        |  3 +++
+ netif_utils.c | 12 ++++++++++++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/mstp.c b/mstp.c
+index aec5cbb..90044fc 100644
+--- a/mstp.c
++++ b/mstp.c
+@@ -1591,8 +1591,11 @@ void MSTP_IN_set_mst_config_id(bridge_t *br, __u16 
revision, __u8 *name)
+         assign(br->MstConfigId.s.revision_level, valueRevision);
+         memset(br->MstConfigId.s.configuration_name, 0,
+                sizeof(br->MstConfigId.s.configuration_name));
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstringop-truncation"
+         strncpy((char *)br->MstConfigId.s.configuration_name, (char *)name,
+                 sizeof(br->MstConfigId.s.configuration_name));
++#pragma GCC diagnostic pop
+         br_state_machines_begin(br);
+     }
+ }
+diff --git a/netif_utils.c b/netif_utils.c
+index 7231750..ce2cfb8 100644
+--- a/netif_utils.c
++++ b/netif_utils.c
+@@ -59,7 +59,10 @@ int get_hwaddr(char *ifname, __u8 *hwaddr)
+ {
+     struct ifreq ifr;
+     memset(&ifr, 0, sizeof(ifr));
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstringop-truncation"
+     strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
++#pragma GCC diagnostic pop
+     if(0 > ioctl(netsock, SIOCGIFHWADDR, &ifr))
+     {
+         ERROR("%s: get hw address failed: %m", ifname);
+@@ -73,7 +76,10 @@ int get_flags(char *ifname)
+ {
+     struct ifreq ifr;
+     memset(&ifr, 0, sizeof(ifr));
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstringop-truncation"
+     strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
++#pragma GCC diagnostic pop
+     if(0 > ioctl(netsock, SIOCGIFFLAGS, &ifr))
+     {
+         ERROR("%s: get interface flags failed: %m", ifname);
+@@ -93,7 +99,10 @@ int if_shutdown(char *ifname)
+         return -1;
+     }
+     ifr.ifr_flags &= ~IFF_UP;
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstringop-truncation"
+     strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
++#pragma GCC diagnostic pop
+     if(0 > ioctl(netsock, SIOCSIFFLAGS, &ifr))
+     {
+         ERROR("%s: set if_down flag failed: %m", ifname);
+@@ -106,7 +115,10 @@ int ethtool_get_speed_duplex(char *ifname, int *speed, 
int *duplex)
+ {
+     struct ifreq ifr;
+     memset(&ifr, 0, sizeof(ifr));
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstringop-truncation"
+     strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
++#pragma GCC diagnostic pop
+     struct ethtool_cmd ecmd;
+ 
+     ecmd.cmd = ETHTOOL_GSET;
+-- 
+2.17.1
+
diff --git a/meta-arago-extras/recipes-support/mstpctl/mstpd_git.bb 
b/meta-arago-extras/recipes-support/mstpctl/mstpd_git.bb
new file mode 100644
index 0000000..eeeeb82
--- /dev/null
+++ b/meta-arago-extras/recipes-support/mstpctl/mstpd_git.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Multiple Spanning Tree Protocol Daemon"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4325afd396febcb659c36b49533135d4 \
+                    
file://debian/copyright;md5=332234a99007d25da40f41ee96aa388f"
+
+SRC_URI = "git://github.com/mstpd/mstpd.git;protocol=https \
+           file://0001-gcc8-strncpy-werror-workaround.patch"
+
+PV = "0.0.7+git${SRCPV}"
+SRCREV = "e4f0ba5a48649a3253f8b353c87c965e12aafc50"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "python"
+RDEPENDS_${PN} = "python-core"
+
+inherit autotools
+
+EXTRA_OECONF = "--sbindir=/sbin"
-- 
2.7.4

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to