diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-19 10:48:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-19 10:48:32 +0200 |
| commit | 47cb10013e6935bb6cdf470925ea5a5f74464646 (patch) | |
| tree | bb871753b0c5f8c7a45a6f55c3977c060ead765c /plugins/check_pgsql.c | |
| parent | 5b29a86e3a31405f3070a82f81b171068576015e (diff) | |
| parent | efe79595d3813b81f873f125260d0f9937535134 (diff) | |
| download | monitoring-plugins-47cb10013e6935bb6cdf470925ea5a5f74464646.tar.gz | |
Merge pull request #1948 from RincewindsHat/more_booleans
Replace most of the boolean variables declared as "int" with "bool"
Diffstat (limited to 'plugins/check_pgsql.c')
| -rw-r--r-- | plugins/check_pgsql.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 61990335..94d589e1 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
| @@ -69,7 +69,7 @@ int process_arguments (int, char **); | |||
| 69 | int validate_arguments (void); | 69 | int validate_arguments (void); |
| 70 | void print_usage (void); | 70 | void print_usage (void); |
| 71 | void print_help (void); | 71 | void print_help (void); |
| 72 | int is_pg_logname (char *); | 72 | bool is_pg_logname (char *); |
| 73 | int do_query (PGconn *, char *); | 73 | int do_query (PGconn *, char *); |
| 74 | 74 | ||
| 75 | char *pghost = NULL; /* host name of the backend server */ | 75 | char *pghost = NULL; /* host name of the backend server */ |
| @@ -252,7 +252,7 @@ main (int argc, char **argv) | |||
| 252 | printf (_(" %s - database %s (%f sec.)|%s\n"), | 252 | printf (_(" %s - database %s (%f sec.)|%s\n"), |
| 253 | state_text(status), dbName, elapsed_time, | 253 | state_text(status), dbName, elapsed_time, |
| 254 | fperfdata("time", elapsed_time, "s", | 254 | fperfdata("time", elapsed_time, "s", |
| 255 | !!(twarn > 0.0), twarn, !!(tcrit > 0.0), tcrit, TRUE, 0, FALSE,0)); | 255 | !!(twarn > 0.0), twarn, !!(tcrit > 0.0), tcrit, true, 0, false,0)); |
| 256 | 256 | ||
| 257 | if (pgquery) | 257 | if (pgquery) |
| 258 | query_status = do_query (conn, pgquery); | 258 | query_status = do_query (conn, pgquery); |
| @@ -393,7 +393,7 @@ process_arguments (int argc, char **argv) | |||
| 393 | 393 | ||
| 394 | <para>&PROTO_validate_arguments;</para> | 394 | <para>&PROTO_validate_arguments;</para> |
| 395 | 395 | ||
| 396 | <para>Given a database name, this function returns TRUE if the string | 396 | <para>Given a database name, this function returns true if the string |
| 397 | is a valid PostgreSQL database name, and returns false if it is | 397 | is a valid PostgreSQL database name, and returns false if it is |
| 398 | not.</para> | 398 | not.</para> |
| 399 | 399 | ||
| @@ -424,7 +424,7 @@ function prototype | |||
| 424 | 424 | ||
| 425 | <para>&PROTO_is_pg_logname;</para> | 425 | <para>&PROTO_is_pg_logname;</para> |
| 426 | 426 | ||
| 427 | <para>Given a username, this function returns TRUE if the string is a | 427 | <para>Given a username, this function returns true if the string is a |
| 428 | valid PostgreSQL username, and returns false if it is not. Valid PostgreSQL | 428 | valid PostgreSQL username, and returns false if it is not. Valid PostgreSQL |
| 429 | usernames are less than &NAMEDATALEN; characters long and consist of | 429 | usernames are less than &NAMEDATALEN; characters long and consist of |
| 430 | letters, numbers, dashes, and underscores, plus possibly some other | 430 | letters, numbers, dashes, and underscores, plus possibly some other |
| @@ -439,12 +439,10 @@ should be added.</para> | |||
| 439 | 439 | ||
| 440 | 440 | ||
| 441 | 441 | ||
| 442 | int | 442 | bool is_pg_logname (char *username) { |
| 443 | is_pg_logname (char *username) | ||
| 444 | { | ||
| 445 | if (strlen (username) > NAMEDATALEN - 1) | 443 | if (strlen (username) > NAMEDATALEN - 1) |
| 446 | return (FALSE); | 444 | return (false); |
| 447 | return (TRUE); | 445 | return (true); |
| 448 | } | 446 | } |
| 449 | 447 | ||
| 450 | /****************************************************************************** | 448 | /****************************************************************************** |
