X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fopenvpn.c;h=a80c09fb58e95e886b86f6be4a537c7de1c4bedb;hb=4e89060ceb1a14ec7f9abfe9caa6b0da7e76bd5c;hp=a98649b6de3fbb9c76917464735e3e7555e72e8c;hpb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;p=collectd.git diff --git a/src/openvpn.c b/src/openvpn.c index a98649b6..a80c09fb 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -80,10 +80,10 @@ struct vpn_status_s { }; typedef struct vpn_status_s vpn_status_t; -static _Bool new_naming_schema = 0; -static _Bool collect_compression = 1; -static _Bool collect_user_count = 0; -static _Bool collect_individual_users = 1; +static bool new_naming_schema; +static bool collect_compression = true; +static bool collect_user_count; +static bool collect_individual_users = true; static const char *config_keys[] = { "StatusFile", "Compression", /* old, deprecated name */ @@ -247,7 +247,7 @@ static int multi1_read(const char *name, FILE *fh) { char *fields[10]; const int max_fields = STATIC_ARRAY_SIZE(fields); long long sum_users = 0; - _Bool found_header = 0; + bool found_header = 0; /* read the file until the "ROUTING TABLE" line is found (no more info after) */ @@ -320,7 +320,7 @@ static int multi2_read(const char *name, FILE *fh) { const int max_fields = STATIC_ARRAY_SIZE(fields); long long sum_users = 0; - _Bool found_header = 0; + bool found_header = 0; int idx_cname = 0; int idx_bytes_recv = 0; int idx_bytes_sent = 0; @@ -429,9 +429,7 @@ static int openvpn_read(user_data_t *user_data) { FILE *fh = fopen(st->file, "r"); if (fh == NULL) { - char errbuf[1024]; - WARNING("openvpn plugin: fopen(%s) failed: %s", st->file, - sstrerror(errno, errbuf, sizeof(errbuf))); + WARNING("openvpn plugin: fopen(%s) failed: %s", st->file, STRERRNO); return -1; } @@ -471,9 +469,7 @@ static int openvpn_config(const char *key, const char *value) { char *status_file = strdup(value); if (status_file == NULL) { - char errbuf[1024]; - ERROR("openvpn plugin: strdup failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("openvpn plugin: strdup failed: %s", STRERRNO); return 1; } @@ -491,9 +487,7 @@ static int openvpn_config(const char *key, const char *value) { /* create a new vpn element */ vpn_status_t *instance = calloc(1, sizeof(*instance)); if (instance == NULL) { - char errbuf[1024]; - ERROR("openvpn plugin: malloc failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("openvpn plugin: malloc failed: %s", STRERRNO); sfree(status_file); return 1; }