X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flogfile.c;h=ee2ed5cef1ee3f99b72906d9161972cfa3235fe7;hb=6e41c3b1f024d7944e5e8010a87933555c662474;hp=e5807f1b4ba5ab6b9a9828cd1929b4547a41dd89;hpb=267bbc64779f9c7b32e063aac0df22be61bda6ae;p=collectd.git diff --git a/src/logfile.c b/src/logfile.c index e5807f1b..ee2ed5ce 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -77,7 +77,7 @@ static int logfile_config(const char *key, const char *value) { static void logfile_print(const char *msg, int severity, cdtime_t timestamp_time) { FILE *fh; - _Bool do_close = 0; + bool do_close = false; char timestamp_str[64]; char level_str[16] = ""; @@ -122,13 +122,12 @@ static void logfile_print(const char *msg, int severity, fh = stdout; else { fh = fopen(log_file, "a"); - do_close = 1; + do_close = true; } if (fh == NULL) { - char errbuf[1024]; fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n", log_file, - sstrerror(errno, errbuf, sizeof(errbuf))); + STRERRNO); } else { if (print_timestamp) fprintf(fh, "[%s] %s%s\n", timestamp_str, level_str, msg); @@ -163,7 +162,7 @@ static int logfile_notification(const notification_t *n, int buf_len = sizeof(buf); int status; - status = ssnprintf( + status = snprintf( buf_ptr, buf_len, "Notification: severity = %s", (n->severity == NOTIF_FAILURE) ? "FAILURE" @@ -177,7 +176,7 @@ static int logfile_notification(const notification_t *n, #define APPEND(bufptr, buflen, key, value) \ if ((buflen > 0) && (strlen(value) > 0)) { \ - status = ssnprintf(bufptr, buflen, ", %s = %s", key, value); \ + status = snprintf(bufptr, buflen, ", %s = %s", key, value); \ if (status > 0) { \ bufptr += status; \ buflen -= status; \