summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-01-16 02:30:21 +0000
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-01-16 02:30:21 +0000
commitf426949e8861b3a97d321516edbcbd771b7d6273 (patch)
tree0cd7a81fe0bd97d2d227280eda62fabbb185154e /source3
parent6e94cbdc30afc3c9b5d2504aa8649fa9c87af7aa (diff)
parent7e2b8eb0797e7bf1f3c4e27fcbd775983080affc (diff)
downloadsamba-f426949e8861b3a97d321516edbcbd771b7d6273.tar.gz
samba-f426949e8861b3a97d321516edbcbd771b7d6273.tar.bz2
samba-f426949e8861b3a97d321516edbcbd771b7d6273.zip
Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test
(This used to be commit 4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/tdb/common/transaction.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c
index 0ecfb9b7ff..ea0e3a93f3 100644
--- a/source3/lib/tdb/common/transaction.c
+++ b/source3/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;
}