tdb2: log an error when out of memory formatting message.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Mar 2011 12:49:20 +0000 (23:19 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Mar 2011 12:49:20 +0000 (23:19 +1030)
Log it at level ERROR and log the raw unformatted message at the requested
level.

ccan/tdb2/tdb.c

index 03d51c2192313a7ce6f9c6e270b92405619fed3c..fa890ec8be9f25d7bb515b14c9280c871e6a683d 100644 (file)
@@ -737,8 +737,9 @@ void COLD tdb_logerr(struct tdb_context *tdb,
 
        message = malloc(len + 1);
        if (!message) {
-               tdb->logfn(tdb, level, tdb->log_private,
-                          "out of memory formatting message");
+               tdb->logfn(tdb, TDB_DEBUG_ERROR, tdb->log_private,
+                          "out of memory formatting message:");
+               tdb->logfn(tdb, level, tdb->log_private, fmt);
                return;
        }
        va_start(ap, fmt);