tdb2: log an error when calling tdb_store() on read-only TDB in tdb1 backend.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 06:01:07 +0000 (15:31 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Aug 2011 06:01:07 +0000 (15:31 +0930)
ccan/tdb2/tdb1_tdb.c

index 99b83ab72d08d7e6b733a1572063c9f8d240ca9d..0e3cc13caba9f9ab4093de2c0325a34012b74715 100644 (file)
@@ -591,7 +591,9 @@ int tdb1_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
        assert(tdb->flags & TDB_VERSION1);
 
        if ((tdb->flags & TDB_RDONLY) || tdb->tdb1.traverse_read) {
-               tdb->last_error = TDB_ERR_RDONLY;
+               tdb->last_error = tdb_logerr(tdb, TDB_ERR_RDONLY,
+                                            TDB_LOG_USE_ERROR,
+                                            "tdb_store: read-only tdb");
                return -1;
        }