Skip to content

Commit

Permalink
Merge pull request #1188 from jimklimov/fightwarn-lgtm
Browse files Browse the repository at this point in the history
  • Loading branch information
jimklimov committed Nov 16, 2021
2 parents a32e949 + ecac0b1 commit 6135bb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions drivers/snmp-ups-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
*
*/

#include "config.h"

/* NUT SNMP common functions */
#include "common.h" /* includes "config.h" which must be the first header */
/*
#include "config.h"
#include "main.h"
#include "nut_float.h"
#include "nut_stdint.h"
*/
#include "snmp-ups.h"
#include "timehead.h" /* time.h => strptime() */

Expand Down
14 changes: 7 additions & 7 deletions drivers/snmp-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
*
*/

#include <ctype.h> /* for isprint() */

/* NUT SNMP common functions */
#include "main.h"
#include "main.h" /* includes "config.h" which must be the first header */
#include "nut_float.h"
#include "nut_stdint.h"
#include "snmp-ups.h"
#include "parseconf.h"

#include <ctype.h> /* for isprint() */

/* include all known mib2nut lookup tables */
#include "apc-mib.h"
#include "mge-mib.h"
Expand Down Expand Up @@ -331,7 +331,7 @@ void upsdrv_makevartable(void)
addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_COMMUNITY,
"Set community name (default=public)");
addvar(VAR_VALUE, SU_VAR_VERSION,
"Set SNMP version (default=v1, allowed v2c)");
"Set SNMP version (default=v1, allowed: v2c,v3)");
addvar(VAR_VALUE, SU_VAR_POLLFREQ,
"Set polling frequency in seconds, to reduce network flow (default=30)");
addvar(VAR_VALUE, SU_VAR_RETRIES,
Expand Down Expand Up @@ -726,13 +726,13 @@ void nut_snmp_init(const char *type, const char *hostname)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Warray-bounds"
#endif
if ((strncmp(version, "v1", 3) == 0) || (strncmp(version, "v2c", 3) == 0)) {
g_snmp_sess.version = (strncmp(version, "v1", 3) == 0) ? SNMP_VERSION_1 : SNMP_VERSION_2c;
if ((strncmp(version, "v1", 2) == 0) || (strncmp(version, "v2c", 3) == 0)) {
g_snmp_sess.version = (strncmp(version, "v1", 2) == 0) ? SNMP_VERSION_1 : SNMP_VERSION_2c;
community = testvar(SU_VAR_COMMUNITY) ? getval(SU_VAR_COMMUNITY) : "public";
g_snmp_sess.community = (unsigned char *)xstrdup(community);
g_snmp_sess.community_len = strlen(community);
}
else if (strncmp(version, "v3", 3) == 0) {
else if (strncmp(version, "v3", 2) == 0) {
#ifdef __clang__
# pragma clang diagnostic pop
#endif
Expand Down

0 comments on commit 6135bb6

Please sign in to comment.