diff options
author | Paul Traina <pst@FreeBSD.org> | 1994-09-08 01:06:46 +0000 |
---|---|---|
committer | Paul Traina <pst@FreeBSD.org> | 1994-09-08 01:06:46 +0000 |
commit | a7ab72edf19c585eb10874adaa53e37aada5cfc2 (patch) | |
tree | 8cc8c2eb5fe898b81264fa37ba1966e6c9ca5998 /sbin | |
parent | 3ce94772cc8bf087b184c786b356a0b35501f6ff (diff) | |
download | src-a7ab72edf19c585eb10874adaa53e37aada5cfc2.tar.gz src-a7ab72edf19c585eb10874adaa53e37aada5cfc2.zip |
Fix endian bug introduced at Berkeley during the Net2->4.4-lite transition.
Fix is courtesy of the NetBSD folks.
Reviewed by: pst
Notes
Notes:
svn path=/head/; revision=2558
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/restore/dirs.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 5a2651c9eeee..79c98977916b 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -56,6 +56,8 @@ static char sccsid[] = "@(#)dirs.c 8.2 (Berkeley) 1/21/94"; #include <string.h> #include <unistd.h> +#include <machine/endian.h> + #include "pathnames.h" #include "restore.h" #include "extern.h" @@ -348,14 +350,16 @@ putdir(buf, size) } else { for (loc = 0; loc < size; ) { dp = (struct direct *)(buf + loc); - if (oldinofmt) { - if (Bcvt) { - swabst((u_char *)"l2s", (u_char *) dp); - } - } else { - if (Bcvt) { - swabst((u_char *)"ls", (u_char *) dp); - } + if (Bcvt) + swabst((u_char *)"ls", (u_char *) dp); + if (oldinofmt && dp->d_ino != 0) { +#if BYTE_ORDER == BIG_ENDIAN + if (Bcvt) +#else + if (!Bcvt) +#endif + dp->d_namlen = dp->d_type; + dp->d_type = DT_UNKNOWN; } i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1)); if ((dp->d_reclen & 0x3) != 0 || |