mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
ufsread: Do not cast struct direct from void *
This cause alignment problem on ARM (and possibly other archs), instead copy it. MFC after: 1 week
This commit is contained in:
parent
be4391a2d5
commit
62ee0c0a9a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305814
@ -97,21 +97,21 @@ static __inline uint8_t
|
||||
fsfind(const char *name, ufs_ino_t * ino)
|
||||
{
|
||||
static char buf[DEV_BSIZE];
|
||||
struct direct *d;
|
||||
static struct direct d;
|
||||
char *s;
|
||||
ssize_t n;
|
||||
|
||||
fs_off = 0;
|
||||
while ((n = fsread(*ino, buf, DEV_BSIZE)) > 0)
|
||||
for (s = buf; s < buf + DEV_BSIZE;) {
|
||||
d = (void *)s;
|
||||
memcpy(&d, s, sizeof(struct direct));
|
||||
if (ls)
|
||||
printf("%s ", d->d_name);
|
||||
else if (!strcmp(name, d->d_name)) {
|
||||
*ino = d->d_ino;
|
||||
return d->d_type;
|
||||
printf("%s ", d.d_name);
|
||||
else if (!strcmp(name, d.d_name)) {
|
||||
*ino = d.d_ino;
|
||||
return d.d_type;
|
||||
}
|
||||
s += d->d_reclen;
|
||||
s += d.d_reclen;
|
||||
}
|
||||
if (n != -1 && ls)
|
||||
printf("\n");
|
||||
|
Loading…
Reference in New Issue
Block a user