{
afs_int32 code;
afs_int32 offset;
+ afs_int32 start;
int blockIndex, entryIndex;
char entry[sizeof(struct block)];
int entrySize;
return BUDB_IO;
/* check if entry is free by looking at the first "afs_int32" of the structure */
- if (*((afs_int32 *) & entry[0]) == 0) { /* zero is free */
+ memcpy(&start, entry, sizeof(start));
+ if (start == 0) { /* zero is free */
/* Is it on any hash chain? */
if (blockMap[blockIndex]->entries[entryIndex] & MAP_HASHES) {
Log("Entry: blockindex %d, entryindex %d - marked free but hashed 0x%x\n", blockIndex, entryIndex, blockMap[blockIndex]->entries[entryIndex]);
afs_uint32 hash;
dbadr a, first_a;
char e[sizeof(struct block)]; /* unnecessarily conservative */
+ struct dump e_dump;
+ struct tape e_tape;
+ struct volInfo e_volinfo;
int e_size;
int old;
fprintf(DUMP, " at %d is ", a);
switch (type) {
case HT_dumpIden_FUNCTION:
- fprintf(DUMP, "%d\n", ntohl(((struct dump *)e)->id));
+ memcpy(&e_dump, e, sizeof(e_dump));
+ fprintf(DUMP, "%d\n", ntohl(e_dump.id));
break;
case HT_dumpName_FUNCTION:
- fprintf(DUMP, "%s\n", ((struct dump *)e)->dumpName);
+ memcpy(&e_dump, e, sizeof(e_dump));
+ fprintf(DUMP, "%s\n", e_dump.dumpName);
break;
case HT_tapeName_FUNCTION:
- fprintf(DUMP, "%s\n", ((struct tape *)e)->name);
+ memcpy(&e_tape, e, sizeof(e_tape));
+ fprintf(DUMP, "%s\n", e_tape.name);
break;
case HT_volName_FUNCTION:
- fprintf(DUMP, "%s\n", ((struct volInfo *)e)->name);
+ memcpy(&e_volinfo, e, sizeof(e_volinfo));
+ fprintf(DUMP, "%s\n", e_volinfo.name);
break;
}
if ((ht_HashEntry(mht, e) % length) != hash)
fi
fi
+CFLAGS_NOSTRICT=
+
+if test "x$GCC" = "xyes"; then
+ CFLAGS_NOSTRICT="-fno-strict-aliasing"
+fi
+
if test "x$GCC" = "xyes"; then
CFLAGS_NOUNUSED="-Wno-unused"
else
AC_SUBST(VFSCK_CFLAGS)
AC_SUBST(XCFLAGS)
AC_SUBST(CFLAGS_NOERROR)
+AC_SUBST(CFLAGS_NOSTRICT)
AC_SUBST(CFLAGS_NOUNUSED)
AC_SUBST(XCFLAGS64)
AC_SUBST(XLDFLAGS)
afs_uint32 temp; /* unsigned for safety */
afs_uint32 pwexpires;
- temp = ntohl(*((afs_int32 *) (tentry.misc_auth_bytes)));
+ memcpy(&temp, tentry.misc_auth_bytes, sizeof(afs_uint32));
+ temp = ntohl(temp);
unpack_long(temp, misc_auth_bytes);
pwexpires = misc_auth_bytes[0];
if (pwexpires) {
ptserver.o: ptserver.c ${INCLS} AFS_component_version_number.c
+# When supergroups is enabled, some parts of ptserver cast between
+# incompatible structs.
ptutils.o: ptutils.c ${INCLS}
+ $(CCOBJ) $(CFLAGS) @CFLAGS_NOSTRICT@ -c ptutils.c
ptprocs.o: ptprocs.c ${INCLS}
+ $(CCOBJ) $(CFLAGS) @CFLAGS_NOSTRICT@ -c ptprocs.c
utils.o: utils.c ${INCLS}
{
/* handle screwed up versions of DumpEntry */
if (e->flags & PRCONT) {
- afs_int32 id = *(afs_int32 *) (e->name);
+ afs_int32 id;
+
+ memcpy(&id, e->name, sizeof(id));
if ((id != PRBADID) && ((id > (1 << 24)) || (id < -(1 << 24)))) {
/* assume server incorrectly swapped these bytes... */
int i = 0;
physio.o: ${VOL}/physio.c
${CCRULE}
+# Uses an alignment hack to convert between incompatible pointers.
fssync-debug.o: ${VOL}/fssync-debug.c
- ${CCRULE}
+ $(CCOBJ) $(CFLAGS) @CFLAGS_NOSTRICT@ -c ${VOL}/fssync-debug.c
salvsync-debug.o: salvsync-debug.c
${CCRULE}
${CC} ${CFLAGS} -o volinfo vol-info.o physio.o \
ihandle.o ${LIBS} ${XLIBS}
+# Uses an alignment hack to convert between incompatible pointers.
+fssync-debug.o: fssync-debug.c
+ $(CCOBJ) $(CFLAGS) @CFLAGS_NOSTRICT@ -c fssync-debug.c
+
fssync-debug: fssync-debug.o physio.o AFS_component_version_number.c ${LIBS}
${CC} ${LDFLAGS} -o fssync-debug fssync-debug.o physio.o ${LIBS} ${XLIBS}