summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2024-10-26 22:52:23 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-11-08 10:49:07 +0100
commitd7671b8a4a8f7a46f5576be7d6d6644c9cd77000 (patch)
treee982690ca5a70398d1ab71d365e0b1962483bfd0 /plugins
parent962053e6ab58ade05a43eb222a0308770ce89634 (diff)
downloadmonitoring-plugins-d7671b8a4a8f7a46f5576be7d6d6644c9cd77000.tar.gz
check_apt: mindless linter fixes
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_apt.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 02af1a43..16c34caf 100644
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
@@ -57,7 +57,7 @@ typedef enum { UPGRADE, DIST_UPGRADE, NO_UPGRADE } upgrade_type;
57#define SECURITY_RE "^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)" 57#define SECURITY_RE "^[^\\(]*\\(.* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)"
58 58
59/* some standard functions */ 59/* some standard functions */
60int process_arguments(int, char **); 60int process_arguments(int /*argc*/, char ** /*argv*/);
61void print_help(void); 61void print_help(void);
62void print_usage(void); 62void print_usage(void);
63 63
@@ -94,8 +94,11 @@ static int stderr_warning = 0; /* if a cmd issued output on stderr */
94static int exec_warning = 0; /* if a cmd exited non-zero */ 94static int exec_warning = 0; /* if a cmd exited non-zero */
95 95
96int main(int argc, char **argv) { 96int main(int argc, char **argv) {
97 int result = STATE_UNKNOWN, packages_available = 0, sec_count = 0; 97 int result = STATE_UNKNOWN;
98 char **packages_list = NULL, **secpackages_list = NULL; 98 int packages_available = 0;
99 int sec_count = 0;
100 char **packages_list = NULL;
101 char **secpackages_list = NULL;
99 102
100 /* Parse extra opts if any */ 103 /* Parse extra opts if any */
101 argv = np_extra_opts(&argc, argv, progname); 104 argv = np_extra_opts(&argc, argv, progname);
@@ -246,10 +249,17 @@ int process_arguments(int argc, char **argv) {
246 249
247/* run an apt-get upgrade */ 250/* run an apt-get upgrade */
248int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist) { 251int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkglist) {
249 int result = STATE_UNKNOWN, regres = 0, pc = 0, spc = 0; 252 int result = STATE_UNKNOWN;
250 struct output chld_out, chld_err; 253 int regres = 0;
251 regex_t ireg, ereg, sreg; 254 int pc = 0;
252 char *cmdline = NULL, rerrbuf[64]; 255 int spc = 0;
256 struct output chld_out;
257 struct output chld_err;
258 regex_t ireg;
259 regex_t ereg;
260 regex_t sreg;
261 char *cmdline = NULL;
262 char rerrbuf[64];
253 263
254 /* initialize ereg as it is possible it is printed while uninitialized */ 264 /* initialize ereg as it is possible it is printed while uninitialized */
255 memset(&ereg, '\0', sizeof(ereg.buffer)); 265 memset(&ereg, '\0', sizeof(ereg.buffer));
@@ -365,7 +375,8 @@ int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkg
365/* run an apt-get update (needs root) */ 375/* run an apt-get update (needs root) */
366int run_update(void) { 376int run_update(void) {
367 int result = STATE_UNKNOWN; 377 int result = STATE_UNKNOWN;
368 struct output chld_out, chld_err; 378 struct output chld_out;
379 struct output chld_err;
369 char *cmdline; 380 char *cmdline;
370 381
371 /* run the update */ 382 /* run the update */
@@ -401,7 +412,9 @@ int run_update(void) {
401} 412}
402 413
403char *pkg_name(char *line) { 414char *pkg_name(char *line) {
404 char *start = NULL, *space = NULL, *pkg = NULL; 415 char *start = NULL;
416 char *space = NULL;
417 char *pkg = NULL;
405 int len = 0; 418 int len = 0;
406 419
407 start = line + strlen(PKGINST_PREFIX); 420 start = line + strlen(PKGINST_PREFIX);
@@ -446,7 +459,8 @@ char *add_to_regexp(char *expr, const char *next) {
446 459
447char *construct_cmdline(upgrade_type u, const char *opts) { 460char *construct_cmdline(upgrade_type u, const char *opts) {
448 int len = 0; 461 int len = 0;
449 const char *opts_ptr = NULL, *aptcmd = NULL; 462 const char *opts_ptr = NULL;
463 const char *aptcmd = NULL;
450 char *cmd = NULL; 464 char *cmd = NULL;
451 465
452 switch (u) { 466 switch (u) {