[AGENT++] [PATCH 1/2] config_snmp_pp.h.in: add missing include

Luca Ceresoli luca at lucaceresoli.net
Fri Sep 2 11:08:55 CEST 2016


config_snmp_pp.h.in uses struct sockaddr and socklen_t but does not
include sys/socket.h where it is defined. So a user program including
config_snmp_pp.h fails with an error like:

  In file included from /usr/include/libagent.h:206:0,
                   from /usr/include/agent_pp/agent++.h:36,
                   from /.../test.cpp:8:
  /usr/include/snmp_pp/config_snmp_pp.h:147:11: error: 'socklen_t' does not name a type
     typedef socklen_t SocketLengthType;
             ^

Add the include for Linux only, since it might be defined elsewhere on
other platforms.

Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>
---
 include/snmp_pp/config_snmp_pp.h.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/snmp_pp/config_snmp_pp.h.in b/include/snmp_pp/config_snmp_pp.h.in
index e7fea4d..4ac3b2a 100644
--- a/include/snmp_pp/config_snmp_pp.h.in
+++ b/include/snmp_pp/config_snmp_pp.h.in
@@ -28,6 +28,10 @@
 #ifndef _CONFIG_SNMP_PP_H_
 #define _CONFIG_SNMP_PP_H_
 
+#ifdef __linux__
+#include <sys/socket.h>
+#endif
+
 #define SNMP_PP_VERSION_STRING "@VERSION@"
 #define SNMP_PP_VERSION @SNMP_PP_MAJOR_VERSION@
 #define SNMP_PP_RELEASE @SNMP_PP_MINOR_VERSION@
-- 
2.7.4



More information about the AGENTPP mailing list