summaryrefslogtreecommitdiffstats
path: root/source4/lib/tdb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-24 02:37:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:48 -0500
commitc0e6586405d2ceb8af9b4252ced83dea931ab8aa (patch)
tree18d824b76091be8acdad799600413c94c520473c /source4/lib/tdb/common
parent036b27c8e4f8bdd61049c5f3b78573937badbdd6 (diff)
downloadsamba-c0e6586405d2ceb8af9b4252ced83dea931ab8aa.tar.gz
samba-c0e6586405d2ceb8af9b4252ced83dea931ab8aa.tar.xz
samba-c0e6586405d2ceb8af9b4252ced83dea931ab8aa.zip
r10460: fixed portability of transaction code to systems with integer
alignment constraints (like sparc) (This used to be commit bce35ad237a55376b6af98416eec92a7c4b422a6)
Diffstat (limited to 'source4/lib/tdb/common')
-rw-r--r--source4/lib/tdb/common/transaction.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c
index 75e91c56ccb..5f281ca4daf 100644
--- a/source4/lib/tdb/common/transaction.c
+++ b/source4/lib/tdb/common/transaction.c
@@ -628,7 +628,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
struct list_struct *rec;
tdb_off_t recovery_offset, recovery_max_size;
tdb_off_t old_map_size = tdb->transaction->old_map_size;
- u32 magic;
+ u32 magic, tailer;
/*
check that the recovery area has enough space
@@ -666,8 +666,8 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
tdb->ecode = TDB_ERR_CORRUPT;
return -1;
}
- ((u32 *)p)[0] = el->offset;
- ((u32 *)p)[1] = el->length;
+ memcpy(p, &el->offset, 4);
+ memcpy(p+4, &el->length, 4);
if (DOCONV()) {
tdb_convert(p, 8);
}
@@ -683,7 +683,8 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
}
/* and the tailer */
- *(u32 *)p = sizeof(*rec) + recovery_max_size;
+ tailer = sizeof(*rec) + recovery_max_size;
+ memcpy(p, &tailer, 4);
CONVERT(p);
/* write the recovery data to the recovery area */
@@ -926,8 +927,8 @@ int tdb_transaction_recover(struct tdb_context *tdb)
if (DOCONV()) {
tdb_convert(p, 8);
}
- ofs = ((u32 *)p)[0];
- len = ((u32 *)p)[1];
+ memcpy(&ofs, p, 4);
+ memcpy(&len, p+4, 4);
if (tdb->methods->tdb_write(tdb, ofs, p+8, len) == -1) {
free(data);