From e185eeed42bad7c797d30a6b865cd1663a96b3d6 Mon Sep 17 00:00:00 2001 From: Patrick Dolinic Date: Thu, 15 Dec 2022 19:19:28 +0100 Subject: [PATCH 1/3] This commit fixes 5 warnings and one note on the GCC 7.5 Compiler of SLES 15.4 with guarding, indentation and unused variables --- snmp_bulkget.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/snmp_bulkget.c b/snmp_bulkget.c index fcb7daf..87e558f 100644 --- a/snmp_bulkget.c +++ b/snmp_bulkget.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) int coll_tolerance = -1; u64 speed = 0; int bw = 0; - size_t size,size2; + size_t size; struct ifStruct *interfaces = NULL; /* current interface data */ struct ifStruct *oldperfdata = NULL; /* previous check interface data */ @@ -146,7 +146,7 @@ main(int argc, char *argv[]) char *indexes=0; #endif /* INDEXES */ #ifdef HAVE_GETADDRINFO - struct addrinfo *addr_list, *addr_listp; + struct addrinfo *addr_list; #endif /* HAVE_GETADDRINFO */ struct timeval tv; @@ -905,27 +905,26 @@ main(int argc, char *argv[]) (match_aliases_flag && !(regexec(&exclude_re, interfaces[i].alias, (size_t) 0, NULL, 0))); } if (status && !status2) { count++; -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "Interface %d (%s) matched\n", interfaces[i].index, interfaces[i].descr); -#endif + #endif } else interfaces[i].ignore = 1; } regfree(&re); - if (exclude_list) - regfree(&exclude_re); + if (exclude_list) + regfree(&exclude_re); if (count) { -#ifdef DEBUG + #ifdef DEBUG fprintf(stderr, "- %d interface%s found\n", count, (count==1)?"":"s"); -#endif + #endif } else { printf("- no interfaces matched regex"); exit (0); - } - - } + } + } /* let the user know about interfaces that are down (and subsequently ignored) */ @@ -1568,7 +1567,7 @@ int parseoids(int i, char *oid_list, struct OIDStruct *query) void create_pdu(int mode, char **oidlist, netsnmp_pdu **pdu, struct OIDStruct **oids, int nonrepeaters, long max) { int i; - static char **oid_ifp; + //static char **oid_ifp; if (mode == NONBULK) *pdu = snmp_pdu_create(SNMP_MSG_GET); From a86c49751923b4edd5f45a80e86a9d64466f8039 Mon Sep 17 00:00:00 2001 From: pdolinic <71389319+pdolinic@users.noreply.github.com> Date: Thu, 15 Dec 2022 22:30:21 +0100 Subject: [PATCH 2/3] Update snmp_bulkget.c Remove last comment on "//static char **oid_ifp;" as it is unused. --- snmp_bulkget.c | 1 - 1 file changed, 1 deletion(-) diff --git a/snmp_bulkget.c b/snmp_bulkget.c index 87e558f..ea17443 100644 --- a/snmp_bulkget.c +++ b/snmp_bulkget.c @@ -1567,7 +1567,6 @@ int parseoids(int i, char *oid_list, struct OIDStruct *query) void create_pdu(int mode, char **oidlist, netsnmp_pdu **pdu, struct OIDStruct **oids, int nonrepeaters, long max) { int i; - //static char **oid_ifp; if (mode == NONBULK) *pdu = snmp_pdu_create(SNMP_MSG_GET); From 8ed494df8cbbf031daa2502df9d99b01afb89a71 Mon Sep 17 00:00:00 2001 From: pdolinic <71389319+pdolinic@users.noreply.github.com> Date: Thu, 22 Dec 2022 13:37:58 +0100 Subject: [PATCH 3/3] Update snmp_bulkget.c Removed indendation on preprocessor macros, added on lines 908, 910, 920, 922 --- snmp_bulkget.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snmp_bulkget.c b/snmp_bulkget.c index ea17443..ed2afdd 100644 --- a/snmp_bulkget.c +++ b/snmp_bulkget.c @@ -905,9 +905,9 @@ main(int argc, char *argv[]) (match_aliases_flag && !(regexec(&exclude_re, interfaces[i].alias, (size_t) 0, NULL, 0))); } if (status && !status2) { count++; - #ifdef DEBUG +#ifdef DEBUG fprintf(stderr, "Interface %d (%s) matched\n", interfaces[i].index, interfaces[i].descr); - #endif +#endif } else interfaces[i].ignore = 1; } @@ -917,9 +917,9 @@ main(int argc, char *argv[]) regfree(&exclude_re); if (count) { - #ifdef DEBUG +#ifdef DEBUG fprintf(stderr, "- %d interface%s found\n", count, (count==1)?"":"s"); - #endif +#endif } else { printf("- no interfaces matched regex"); exit (0);