diff options
author | Robin Sonefors <robin.sonefors@op5.com> | 2013-01-29 15:08:44 +0100 |
---|---|---|
committer | Robin Sonefors <robin.sonefors@op5.com> | 2013-01-29 15:30:04 +0100 |
commit | a20611d4357c3c3ebe0a62776a1642e7904c1410 (patch) | |
tree | 60a320d4a521bb3de4d556b618da0f17d3d05c0e /plugins | |
parent | d87395ec3d4bec777ab92fc74c8370877171259f (diff) | |
download | monitoring-plugins-a20611d4357c3c3ebe0a62776a1642e7904c1410.tar.gz |
check_snmp: Close potential for using uninitialized memory
This was reported by clang, and in order for it to understand attributes
properly, I had to modify the macro that checks for non-gcc compilers.
Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 3 | ||||
-rw-r--r-- | plugins/common.h | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 28354b0d..c73562ba 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -229,13 +229,14 @@ main (int argc, char **argv) | |||
229 | 229 | ||
230 | np_set_args(argc, argv); | 230 | np_set_args(argc, argv); |
231 | 231 | ||
232 | time(¤t_time); | ||
233 | |||
232 | if (process_arguments (argc, argv) == ERROR) | 234 | if (process_arguments (argc, argv) == ERROR) |
233 | usage4 (_("Could not parse arguments")); | 235 | usage4 (_("Could not parse arguments")); |
234 | 236 | ||
235 | if(calculate_rate) { | 237 | if(calculate_rate) { |
236 | if (!strcmp(label, "SNMP")) | 238 | if (!strcmp(label, "SNMP")) |
237 | label = strdup("SNMP RATE"); | 239 | label = strdup("SNMP RATE"); |
238 | time(¤t_time); | ||
239 | i=0; | 240 | i=0; |
240 | previous_state = np_state_read(); | 241 | previous_state = np_state_read(); |
241 | if(previous_state!=NULL) { | 242 | if(previous_state!=NULL) { |
diff --git a/plugins/common.h b/plugins/common.h index c0dc2f41..f024b2ae 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
@@ -208,9 +208,9 @@ enum { | |||
208 | # define bindtextdomain(Domainname, Dirname) /* empty */ | 208 | # define bindtextdomain(Domainname, Dirname) /* empty */ |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | /* For non-GNU compilers to ignore __attribute__ */ | 211 | /* For non-GNU/non-clang compilers to ignore __attribute__ */ |
212 | #ifndef __GNUC__ | 212 | #if !defined(__GNUC__) && !defined(__CLANG__) |
213 | # define __attribute__(x) /* do nothing */ | 213 | # define __attribute__(noreturn) /* do nothing */ |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | #endif /* _COMMON_H_ */ | 216 | #endif /* _COMMON_H_ */ |