Fix endian bug introduced at Berkeley during the Net2->4.4-lite transition.

Fix is courtesy of the NetBSD folks.

Reviewed by:	pst
This commit is contained in:
Paul Traina 1994-09-08 01:06:46 +00:00
parent 3ce94772cc
commit a7ab72edf1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2558

View File

@ -56,6 +56,8 @@ static char sccsid[] = "@(#)dirs.c 8.2 (Berkeley) 1/21/94";
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <machine/endian.h>
#include "pathnames.h" #include "pathnames.h"
#include "restore.h" #include "restore.h"
#include "extern.h" #include "extern.h"
@ -348,14 +350,16 @@ putdir(buf, size)
} else { } else {
for (loc = 0; loc < size; ) { for (loc = 0; loc < size; ) {
dp = (struct direct *)(buf + loc); dp = (struct direct *)(buf + loc);
if (oldinofmt) { if (Bcvt)
if (Bcvt) { swabst((u_char *)"ls", (u_char *) dp);
swabst((u_char *)"l2s", (u_char *) dp); if (oldinofmt && dp->d_ino != 0) {
} #if BYTE_ORDER == BIG_ENDIAN
} else { if (Bcvt)
if (Bcvt) { #else
swabst((u_char *)"ls", (u_char *) dp); if (!Bcvt)
} #endif
dp->d_namlen = dp->d_type;
dp->d_type = DT_UNKNOWN;
} }
i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1)); i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1));
if ((dp->d_reclen & 0x3) != 0 || if ((dp->d_reclen & 0x3) != 0 ||