diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-25 09:03:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-25 09:03:21 +0100 |
commit | 36415f0c3ecbed76f3e7c161885704f964f2e385 (patch) | |
tree | a9114caaefaa1f25ccae58b0a49d3a4f7b0d1433 /plugins/check_hpjd.c | |
parent | c39de8869e5352a5503607258996b8461ff27c14 (diff) | |
parent | d28bab4dbdf5b5be37b70164dd4a6d55e0ca9380 (diff) | |
download | monitoring-plugins-36415f0c3ecbed76f3e7c161885704f964f2e385.tar.gz |
Merge pull request #1729 from RincewindsHat/fix_QL_problems
Fix some QL problems
Diffstat (limited to 'plugins/check_hpjd.c')
-rw-r--r-- | plugins/check_hpjd.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 65465567..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:%hd %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 (); |