svn commit: samba r10460 - in branches/SAMBA_4_0/source/lib/tdb/common: .

tridge at samba.org tridge at samba.org
Sat Sep 24 02:37:22 GMT 2005


Author: tridge
Date: 2005-09-24 02:37:22 +0000 (Sat, 24 Sep 2005)
New Revision: 10460

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10460

Log:
fixed portability of transaction code to systems with integer
alignment constraints (like sparc)

Modified:
   branches/SAMBA_4_0/source/lib/tdb/common/transaction.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/tdb/common/transaction.c
===================================================================
--- branches/SAMBA_4_0/source/lib/tdb/common/transaction.c	2005-09-24 02:31:43 UTC (rev 10459)
+++ branches/SAMBA_4_0/source/lib/tdb/common/transaction.c	2005-09-24 02:37:22 UTC (rev 10460)
@@ -628,7 +628,7 @@
 	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 @@
 			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 @@
 	}
 
 	/* 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 @@
 		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);



More information about the samba-cvs mailing list