diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-05-28 16:53:56 +0930 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-05-28 11:22:14 +0200 |
commit | 3bd686c5ad4756af1033ac14ba09a40156cc6d47 (patch) | |
tree | 55d7d61637fa477e542f2d8c291835be0f8a415c /lib/tdb/common/check.c | |
parent | 5a633dd6bb5be817c6b421df0c098e3428a20773 (diff) | |
download | samba-3bd686c5ad4756af1033ac14ba09a40156cc6d47.tar.gz samba-3bd686c5ad4756af1033ac14ba09a40156cc6d47.tar.bz2 samba-3bd686c5ad4756af1033ac14ba09a40156cc6d47.zip |
tdb: fix logging of offets and lengths.
We can have offsets > 2G, so use unsigned values. Fixes other prints to be
native types rather than casts, too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue May 28 11:22:14 CEST 2013 on sn-devel-104
Diffstat (limited to 'lib/tdb/common/check.c')
-rw-r--r-- | lib/tdb/common/check.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/tdb/common/check.c b/lib/tdb/common/check.c index dc38102f0c..9f9d8708c1 100644 --- a/lib/tdb/common/check.c +++ b/lib/tdb/common/check.c @@ -76,19 +76,19 @@ static bool tdb_check_record(struct tdb_context *tdb, /* Check rec->next: 0 or points to record offset, aligned. */ if (rec->next > 0 && rec->next < TDB_DATA_START(tdb->hash_size)){ TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d too small next %d\n", + "Record offset %u too small next %u\n", off, rec->next)); goto corrupt; } if (rec->next + sizeof(*rec) < rec->next) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d too large next %d\n", + "Record offset %u too large next %u\n", off, rec->next)); goto corrupt; } if ((rec->next % TDB_ALIGNMENT) != 0) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d misaligned next %d\n", + "Record offset %u misaligned next %u\n", off, rec->next)); goto corrupt; } @@ -98,14 +98,14 @@ static bool tdb_check_record(struct tdb_context *tdb, /* Check rec_len: similar to rec->next, implies next record. */ if ((rec->rec_len % TDB_ALIGNMENT) != 0) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d misaligned length %d\n", + "Record offset %u misaligned length %u\n", off, rec->rec_len)); goto corrupt; } /* Must fit tailer. */ if (rec->rec_len < sizeof(tailer)) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d too short length %d\n", + "Record offset %u too short length %u\n", off, rec->rec_len)); goto corrupt; } @@ -119,7 +119,7 @@ static bool tdb_check_record(struct tdb_context *tdb, goto corrupt; if (tailer != sizeof(*rec) + rec->rec_len) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d invalid tailer\n", off)); + "Record offset %u invalid tailer\n", off)); goto corrupt; } @@ -247,7 +247,7 @@ static bool tdb_check_used_record(struct tdb_context *tdb, /* key + data + tailer must fit in record */ if (rec->key_len + rec->data_len + sizeof(tdb_off_t) > rec->rec_len) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d too short for contents\n", off)); + "Record offset %u too short for contents\n", off)); return false; } @@ -257,7 +257,7 @@ static bool tdb_check_used_record(struct tdb_context *tdb, if (tdb->hash_fn(&key) != rec->full_hash) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Record offset %d has incorrect hash\n", off)); + "Record offset %u has incorrect hash\n", off)); goto fail_put_key; } @@ -411,14 +411,14 @@ _PUBLIC_ int tdb_check(struct tdb_context *tdb, goto corrupt; TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Dead space at %d-%d (of %u)\n", + "Dead space at %u-%u (of %u)\n", off, off + dead, tdb->map_size)); rec.rec_len = dead - sizeof(rec); break; case TDB_RECOVERY_MAGIC: if (recovery_start != off) { TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Unexpected recovery record at offset %d\n", + "Unexpected recovery record at offset %u\n", off)); goto free; } @@ -428,7 +428,7 @@ _PUBLIC_ int tdb_check(struct tdb_context *tdb, corrupt: tdb->ecode = TDB_ERR_CORRUPT; TDB_LOG((tdb, TDB_DEBUG_ERROR, - "Bad magic 0x%x at offset %d\n", + "Bad magic 0x%x at offset %u\n", rec.magic, off)); goto free; } |