Ver código fonte

PubSub: Fix GCC issue for structure initialization #2134

The issue and the solution were reported by Andrew Crosland.
Julius Pfrommer 6 anos atrás
pai
commit
e083b179a2
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      plugins/ua_network_pubsub_ethernet.c

+ 2 - 1
plugins/ua_network_pubsub_ethernet.c

@@ -154,7 +154,8 @@ UA_PubSubChannelEthernet_open(const UA_PubSubConnectionConfig *connectionConfig)
     }
 
     /* get interface index */
-    struct ifreq ifreq = { 0 };
+    struct ifreq ifreq;
+    memset(&ifreq, 0, sizeof(struct ifreq));
     strncpy(ifreq.ifr_name, (char*)address->networkInterface.data,
             UA_MIN(address->networkInterface.length, sizeof(ifreq.ifr_name)-1));