From cfbbce8f9143663ffdc6c3a92ff6e5919d0ee75a Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 8 Nov 2010 10:01:16 +0100 Subject: [PATCH] fixed c++ guards in net-snmp header files Resolves: #650219 --- net-snmp-5.6-cpp-includes.patch | 196 ++++++++++++++++++++++++++++++++ net-snmp.spec | 7 +- 2 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 net-snmp-5.6-cpp-includes.patch diff --git a/net-snmp-5.6-cpp-includes.patch b/net-snmp-5.6-cpp-includes.patch new file mode 100644 index 0000000..2384c09 --- /dev/null +++ b/net-snmp-5.6-cpp-includes.patch @@ -0,0 +1,196 @@ +commit a566ddb17d58fcd7def877583882dfd455793b5c +Author: magfr +Date: Tue Oct 12 05:35:33 2010 +0000 + + CHANGES: snmplib: Correct the extern "C" declarations to be consistent. Remove commented out code. + + + git-svn-id: https://net-snmp.svn.sourceforge.net/svnroot/net-snmp/trunk@19414 06827809-a52a-0410-b366-d66718629ded + +diff --git a/net-snmp/include/net-snmp/library/snmp_api.h b/net-snmp/include/net-snmp/library/snmp_api.h +index bf5e010..5ef1eb7 100644 +--- a/net-snmp/include/net-snmp/library/snmp_api.h ++++ b/net-snmp/include/net-snmp/library/snmp_api.h +@@ -115,10 +115,6 @@ typedef struct request_list { + #endif + #define SNMP_DEFAULT_PRIV_PROTOLEN USM_LENGTH_OID_TRANSFORM + +-/* Moved to output_api.h +- NETSNMP_IMPORT const char *snmp_api_errstring(int); +- NETSNMP_IMPORT void snmp_perror(const char *); +- */ + NETSNMP_IMPORT void snmp_set_detail(const char *); + + #define SNMP_MAX_MSG_SIZE 1472 /* ethernet MTU minus IP/UDP header */ +@@ -459,19 +455,10 @@ struct netsnmp_transport_s; + int snmp_get_do_debugging(void); + + +-/* Moved to output_api.h +- NETSNMP_IMPORT +- void snmp_sess_error(void *, int *, int *, char **); +- */ + NETSNMP_IMPORT + void netsnmp_sess_log_error(int priority, + const char *prog_string, + netsnmp_session * ss); +-/* Moved to output_api.h +- NETSNMP_IMPORT +- void snmp_sess_perror(const char *prog_string, +- netsnmp_session * ss); +- */ + const char * snmp_pdu_type(int type); + + /* +diff --git a/net-snmp/include/net-snmp/library/snmp_client.h b/net-snmp/include/net-snmp/library/snmp_client.h +index 0de5bb9..c023253 100644 +--- a/net-snmp/include/net-snmp/library/snmp_client.h ++++ b/net-snmp/include/net-snmp/library/snmp_client.h +@@ -80,10 +80,6 @@ extern "C" { + NETSNMP_IMPORT + int snmp_clone_var(netsnmp_variable_list *, + netsnmp_variable_list *); +-/* Moved to output_api.h +- NETSNMP_IMPORT +- const char *snmp_errstring(int); +- */ + NETSNMP_IMPORT + int snmp_synch_response_cb(netsnmp_session *, + netsnmp_pdu *, netsnmp_pdu **, +diff --git a/net-snmp/include/net-snmp/library/snmp_debug.h b/net-snmp/include/net-snmp/library/snmp_debug.h +index 24de1c4..2984520 100644 +--- a/net-snmp/include/net-snmp/library/snmp_debug.h ++++ b/net-snmp/include/net-snmp/library/snmp_debug.h +@@ -201,9 +201,17 @@ extern "C" { + /*****************************************************************/ + #endif /* NETSNMP_NO_DEBUGGING */ + ++#ifdef __cplusplus ++} ++#endif ++ + /* Public macros moved to top-level API header file */ + #include + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + void snmp_debug_init(void); + + #define MAX_DEBUG_TOKENS 256 +diff --git a/net-snmp/include/net-snmp/library/snmp_logging.h b/net-snmp/include/net-snmp/library/snmp_logging.h +index cbc576f..1d7921b 100644 +--- a/net-snmp/include/net-snmp/library/snmp_logging.h ++++ b/net-snmp/include/net-snmp/library/snmp_logging.h +@@ -1,10 +1,6 @@ + #ifndef SNMP_LOGGING_H + #define SNMP_LOGGING_H + +-#ifdef __cplusplus +-extern "C" { +-#endif +- + #include + #include + +@@ -14,6 +10,10 @@ extern "C" { + #include + #include + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + #ifndef LOG_ERR + #define LOG_EMERG 0 /* system is unusable */ + #define LOG_ALERT 1 /* action must be taken immediately */ +@@ -43,21 +43,12 @@ extern "C" { + } while(0) + + void init_snmp_logging(void); +-/* Moved to output_api.h +- void shutdown_snmp_logging(void); +- NETSNMP_IMPORT +- int snmp_get_do_logging(void); +- */ + NETSNMP_IMPORT + void snmp_disable_syslog(void); + void snmp_disable_filelog(void); + NETSNMP_IMPORT + void snmp_disable_stderrlog(void); + void snmp_disable_calllog(void); +-/* Moved to output_api.h +- NETSNMP_IMPORT +- void snmp_disable_log(void); +- */ + NETSNMP_IMPORT + void snmp_enable_syslog(void); + NETSNMP_IMPORT +@@ -73,31 +64,6 @@ extern "C" { + NETSNMP_IMPORT + int snmp_stderrlog_status(void); + +-/* Moved to output_api.h +-#if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) +- NETSNMP_IMPORT +- int snmp_log(int priority, const char *format, ...); +-#else +- NETSNMP_IMPORT +- int snmp_log(int priority, const char *format, ...) +- __attribute__ ((__format__ (__printf__, 2, 3))); +-#endif +- int snmp_vlog(int priority, const char *format, +- va_list ap); +- */ +- +- /* +- * 0 - successful message formatting +- * -1 - Could not format log-string +- * -2 - Could not allocate memory for log-message +- * -3 - Log-message too long! +- */ +- +-/* Moved to output_api.h +- NETSNMP_IMPORT +- void snmp_log_perror(const char *s); +- */ +- + + #define NETSNMP_LOGHANDLER_STDOUT 1 + #define NETSNMP_LOGHANDLER_STDERR 2 +diff --git a/net-snmp/include/net-snmp/output_api.h b/net-snmp/include/net-snmp/output_api.h +index 8627841..b55def5 100644 +--- a/net-snmp/include/net-snmp/output_api.h ++++ b/net-snmp/include/net-snmp/output_api.h +@@ -9,6 +9,10 @@ + #include + #include /* for va_list */ + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /* Error reporting */ + NETSNMP_IMPORT + void snmp_error(netsnmp_session *sess, int *clib_errorno, +@@ -21,7 +25,7 @@ + const char *snmp_api_errstring(int snmp_errorno); /* library errors */ + NETSNMP_IMPORT + const char *snmp_errstring(int snmp_errorno); /* protocol errors */ +- ++ + NETSNMP_IMPORT + void snmp_perror(const char *msg); /* for parsing errors only */ + +@@ -137,6 +141,10 @@ + * Hence they are listed here: + */ + ++#ifdef __cplusplus ++} ++#endif ++ + #include + #include + #include diff --git a/net-snmp.spec b/net-snmp.spec index 543e362..220755c 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -11,7 +11,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: 5.6 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 License: BSD @@ -33,6 +33,7 @@ Patch4: net-snmp-5.5-include-struct.patch Patch5: net-snmp-5.5-apsl-copying.patch Patch6: net-snmp-5.5-perl-linking.patch Patch7: net-snmp-5.6-test-debug.patch +Patch8: net-snmp-5.6-cpp-includes.patch Requires(post): chkconfig Requires(preun): chkconfig @@ -163,6 +164,7 @@ Net-SNMP toolkit library. %patch5 -p1 -b .apsl %patch6 -p1 -b .perl-linking %patch7 -p1 +%patch8 -p2 -b .cpp-includes %build MIBS="host agentx smux \ @@ -420,6 +422,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_datadir}/snmp/mibs/* %changelog +* Fri Nov 5 2010 Jan Safranek - 1:5.6-2 +- fixed c++ guards in net-snmp header files (#650219) + * Mon Oct 25 2010 Jan Safranek - 1:5.6-1 - updated to net-snmp-5.6