- if (offset + length > tdb->file->map_size) {
- free(data);
- return tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR,
- "tdb_transaction_setup_recovery:"
- " transaction data over new region"
- " boundary");
- }
- memcpy(p, &offset, sizeof(offset));
- memcpy(p + sizeof(offset), &length, sizeof(length));
- tdb_convert(tdb, p, sizeof(offset) + sizeof(length));
-
- /* the recovery area contains the old data, not the
- new data, so we have to call the original tdb_read
- method to get it */
- if (offset + length > old_map_size) {
- /* Short read at EOF, and zero fill. */
- unsigned int len = old_map_size - offset;
- ecode = methods->tread(tdb, offset,
- p + sizeof(offset) + sizeof(length),
- len);
- memset(p + sizeof(offset) + sizeof(length) + len, 0,
- length - len);
- } else {
- ecode = methods->tread(tdb, offset,
- p + sizeof(offset) + sizeof(length),
- length);