Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/tunefs Provide proper alignement for "buf" - it is cast...
details: https://anonhg.NetBSD.org/src/rev/4d7abe04b15b
branches: trunk
changeset: 328973:4d7abe04b15b
user: martin <martin%NetBSD.org@localhost>
date: Sat Apr 26 13:23:49 2014 +0000
description:
Provide proper alignement for "buf" - it is casted to a struct fs pointer,
so it requires the same alignement.
Fixes crashes on armv5.
diffstat:
sbin/tunefs/tunefs.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diffs (50 lines):
diff -r f55128699e1e -r 4d7abe04b15b sbin/tunefs/tunefs.c
--- a/sbin/tunefs/tunefs.c Sat Apr 26 11:23:56 2014 +0000
+++ b/sbin/tunefs/tunefs.c Sat Apr 26 13:23:49 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $ */
+/* $NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)tunefs.c 8.3 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $");
+__RCSID("$NetBSD: tunefs.c,v 1.47 2014/04/26 13:23:49 martin Exp $");
#endif
#endif /* not lint */
@@ -71,10 +71,9 @@
union {
struct fs sb;
- char pad[MAXBSIZE];
-} sbun;
+ char data[MAXBSIZE];
+} sbun, buf;
#define sblock sbun.sb
-char buf[MAXBSIZE];
int fi;
long dev_bsize = 512;
@@ -326,14 +325,14 @@
exit(0);
}
- memcpy(buf, (char *)&sblock, SBLOCKSIZE);
+ memcpy(&buf, (char *)&sblock, SBLOCKSIZE);
if (needswap)
- ffs_sb_swap((struct fs*)buf, (struct fs*)buf);
- bwrite(sblockloc, buf, SBLOCKSIZE, special);
+ ffs_sb_swap((struct fs*)&buf, (struct fs*)&buf);
+ bwrite(sblockloc, buf.data, SBLOCKSIZE, special);
if (Aflag)
for (i = 0; i < sblock.fs_ncg; i++)
bwrite(FFS_FSBTODB(&sblock, cgsblock(&sblock, i)),
- buf, SBLOCKSIZE, special);
+ buf.data, SBLOCKSIZE, special);
close(fi);
exit(0);
}
Home |
Main Index |
Thread Index |
Old Index