aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> 2021-11-24 15:38:18 +0100
committerGravatar RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> 2021-11-24 15:38:18 +0100
commit40d4e8a057a77e357c26d701c5fd304b51787b93 (patch)
tree1fbc9ce2d9ad7b73d588613b2ded540266317854 /plugins
parente2f24a5af3fe407035c8c57f539148f2d694973b (diff)
downloadmonitoring-plugins-40d4e8a057a77e357c26d701c5fd304b51787b93.tar.gz
check_hpjd: Fixing port option
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_hpjd.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index d3d72d7e..c4b44178 100644
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
@@ -66,7 +66,7 @@ void print_usage (void);
char *community = NULL;
char *address = NULL;
-char *port = NULL;
+unsigned int port = 0;
int check_paper_out = 1;
int
@@ -121,8 +121,12 @@ main (int argc, char **argv)
HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
/* get the command to run */
- sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%s %s", PATH_TO_SNMPGET, community,
- address, port, query_string);
+ sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%u %s",
+ PATH_TO_SNMPGET,
+ community,
+ address,
+ port,
+ query_string);
/* run the command */
child_process = spopen (command_line);
@@ -380,11 +384,8 @@ process_arguments (int argc, char **argv)
community = strdup (DEFAULT_COMMUNITY);
}
- if (port == NULL) {
- if (argv[c] != NULL )
- port = argv[c];
- else
- port = atoi (DEFAULT_PORT);
+ if (port == 0) {
+ port = atoi(DEFAULT_PORT);
}
return validate_arguments ();