X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Flogfile.c;h=66922870c0c0682b8deaf85a3f95425bc5db07ff;hp=eca8c34758363507872f33ec13b075019c3575a0;hb=a9e50e9e30ecde17e167e271060c8183bfcbf407;hpb=57b9e83320b35d4dbd1312db5fbf33ddf8ecd989 diff --git a/src/logfile.c b/src/logfile.c index eca8c347..66922870 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -53,7 +53,7 @@ static int logfile_config(const char *key, const char *value) { if (log_level < 0) { log_level = LOG_INFO; ERROR("logfile: invalid loglevel [%s] defaulting to 'info'", value); - return (1); + return 1; } } else if (0 == strcasecmp(key, "File")) { sfree(log_file); @@ -126,9 +126,8 @@ static void logfile_print(const char *msg, int severity, } 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; \ @@ -194,7 +193,7 @@ static int logfile_notification(const notification_t *n, logfile_print(buf, LOG_INFO, (n->time != 0) ? n->time : cdtime()); - return (0); + return 0; } /* int logfile_notification */ void module_register(void) {