mirror of
https://github.com/samba-team/samba.git
synced 2025-01-20 14:03:59 +03:00
Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test
(This used to be commit 4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe)
This commit is contained in:
commit
f426949e88
@ -316,25 +316,15 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blk == tdb->transaction->num_blocks-1 &&
|
||||||
|
off + len > tdb->transaction->last_block_size) {
|
||||||
|
len = tdb->transaction->last_block_size - off;
|
||||||
|
}
|
||||||
|
|
||||||
/* overwrite part of an existing block */
|
/* 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);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user