From fbc7a2ea8f6510f14a5f670dbd1ed8d7b87bac20 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 8 Jan 2010 19:20:43 +0100 Subject: Don't print false error warning if logp == NULL --- src/dmilog.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dmilog.c b/src/dmilog.c index acc465f..e9b89e8 100644 --- a/src/dmilog.c +++ b/src/dmilog.c @@ -85,7 +85,13 @@ int log_append(Log_t *logp, int level, const char *fmt, ...) va_start(ap, fmt); if( !ptr || !ptr->next || !ptr->next->message ) { - fprintf(stderr, "** ERROR ** Failed to save log entry\n"); + if( logp ) { + // Only print this if we logp is pointing somewhere. + // If it is NULL, the caller did not establish a log + // buffer on purpose (like dmidump.c) - thus this is + // not an error with saving the log entry. + fprintf(stderr, "** ERROR ** Failed to save log entry\n"); + } vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); -- cgit