diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-01-18 15:33:57 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-01-18 15:33:57 +1100 |
commit | 524d280ad09c99bcbf63d789e909afdf7edb5860 (patch) | |
tree | 06aee6a02dae7c6d86ad3a9d74b85df80f7e74c9 /source4/lib/tdb/common/transaction.c | |
parent | 55ad09a01b31f2d2c9503f744b519e089f9f936b (diff) | |
download | samba-524d280ad09c99bcbf63d789e909afdf7edb5860.tar.gz samba-524d280ad09c99bcbf63d789e909afdf7edb5860.tar.bz2 samba-524d280ad09c99bcbf63d789e909afdf7edb5860.zip |
merged tdb changes from ctdb
(This used to be commit c54c087a19e36e0522eb4546c9425ae446f0628b)
Diffstat (limited to 'source4/lib/tdb/common/transaction.c')
-rw-r--r-- | source4/lib/tdb/common/transaction.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c index 0ecfb9b7ff..ea0e3a93f3 100644 --- a/source4/lib/tdb/common/transaction.c +++ b/source4/lib/tdb/common/transaction.c @@ -316,25 +316,15 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, return 0; } - /* overwrite part of an existing block */ - if (buf == NULL) { - memset(tdb->transaction->blocks[blk] + off, 0, len); - } else { - memcpy(tdb->transaction->blocks[blk] + off, buf, len); - } - if (blk == tdb->transaction->num_blocks-1) { - if (len + off > tdb->transaction->last_block_size) { - tdb->transaction->last_block_size = len + off; - } + if (blk == tdb->transaction->num_blocks-1 && + off + len > tdb->transaction->last_block_size) { + len = tdb->transaction->last_block_size - off; } - return 0; + /* overwrite part of an existing block */ + memcpy(tdb->transaction->blocks[blk] + off, buf, len); -fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", - (blk*tdb->transaction->block_size) + off, len)); - tdb->transaction->transaction_error = 1; - return -1; + return 0; } |