diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2022-01-03 12:48:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-03 12:48:39 (GMT) |
commit | 2714df42fd27ec377228a102acff3744d6bff86d (patch) | |
tree | 3098fa3d9be4826e5da9d1df39ecf6b42bf3570b /plugins/check_hpjd.c | |
parent | 11af74de386ba7c02d5d0e53f2500b5029a4537d (diff) | |
parent | 78a999edd4dd3305ef8fa3e06c43f6a893fb6fea (diff) | |
download | monitoring-plugins-2714df42fd27ec377228a102acff3744d6bff86d.tar.gz |
Merge branch 'master' into master
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 6546556..c4b4417 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -66,7 +66,7 @@ void print_usage (void); | |||
66 | 66 | ||
67 | char *community = NULL; | 67 | char *community = NULL; |
68 | char *address = NULL; | 68 | char *address = NULL; |
69 | char *port = NULL; | 69 | unsigned int port = 0; |
70 | int check_paper_out = 1; | 70 | int check_paper_out = 1; |
71 | 71 | ||
72 | int | 72 | int |
@@ -121,8 +121,12 @@ main (int argc, char **argv) | |||
121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | 121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); |
122 | 122 | ||
123 | /* get the command to run */ | 123 | /* get the command to run */ |
124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community, | 124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%u %s", |
125 | address, port, query_string); | 125 | PATH_TO_SNMPGET, |
126 | community, | ||
127 | address, | ||
128 | port, | ||
129 | query_string); | ||
126 | 130 | ||
127 | /* run the command */ | 131 | /* run the command */ |
128 | child_process = spopen (command_line); | 132 | child_process = spopen (command_line); |
@@ -380,11 +384,8 @@ process_arguments (int argc, char **argv) | |||
380 | community = strdup (DEFAULT_COMMUNITY); | 384 | community = strdup (DEFAULT_COMMUNITY); |
381 | } | 385 | } |
382 | 386 | ||
383 | if (port == NULL) { | 387 | if (port == 0) { |
384 | if (argv[c] != NULL ) | 388 | port = atoi(DEFAULT_PORT); |
385 | port = argv[c]; | ||
386 | else | ||
387 | port = atoi (DEFAULT_PORT); | ||
388 | } | 389 | } |
389 | 390 | ||
390 | return validate_arguments (); | 391 | return validate_arguments (); |