summaryrefslogtreecommitdiffstats
path: root/sbin/restore
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-09-08 01:06:46 +0000
committerpst <pst@FreeBSD.org>1994-09-08 01:06:46 +0000
commit644accfcba4ead1ce68c3b2b12427c870e45ab03 (patch)
tree8cc8c2eb5fe898b81264fa37ba1966e6c9ca5998 /sbin/restore
parentfd5b2f1678134bf9e94753f064f47b317adafb79 (diff)
downloadFreeBSD-src-644accfcba4ead1ce68c3b2b12427c870e45ab03.zip
FreeBSD-src-644accfcba4ead1ce68c3b2b12427c870e45ab03.tar.gz
Fix endian bug introduced at Berkeley during the Net2->4.4-lite transition.
Fix is courtesy of the NetBSD folks. Reviewed by: pst
Diffstat (limited to 'sbin/restore')
-rw-r--r--sbin/restore/dirs.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 5a2651c..79c9897 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 ||
OpenPOWER on IntegriCloud