aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck/dir.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2000-07-06 02:03:11 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2000-07-06 02:03:11 +0000
commit142d8d2f406cdf3f3bb9ff73c2f09b6cc6f669a4 (patch)
treee3a516356ec5c442750fd8f2fb9a232dc160c131 /sbin/fsck/dir.c
parent8b158403557f7a0ee714ef5ba33219cd08419456 (diff)
downloadsrc-142d8d2f406cdf3f3bb9ff73c2f09b6cc6f669a4.tar.gz
src-142d8d2f406cdf3f3bb9ff73c2f09b6cc6f669a4.zip
Teach fsck about snapshot files. These changes should have no
effect on operation of fsck on filesystems without snapshots. If you get compilation errors, be sure that you have copies of /usr/include/sys/mount.h (1.94), /usr/include/sys/stat.h (1.21), and /usr/include/ufs/ffs/fs.h (1.16) as of July 4, 2000 or later.
Notes
Notes: svn path=/head/; revision=62668
Diffstat (limited to 'sbin/fsck/dir.c')
-rw-r--r--sbin/fsck/dir.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/fsck/dir.c b/sbin/fsck/dir.c
index f5fb6a0ef30a..5ce99f6b7b54 100644
--- a/sbin/fsck/dir.c
+++ b/sbin/fsck/dir.c
@@ -241,7 +241,7 @@ dircheck(idesc, dp)
if (dp->d_reclen == 0 ||
dp->d_reclen > spaceleft ||
(dp->d_reclen & 0x3) != 0)
- return (0);
+ goto bad;
if (dp->d_ino == 0)
return (1);
size = DIRSIZ(!newinofmt, dp);
@@ -261,13 +261,19 @@ dircheck(idesc, dp)
idesc->id_filesize < size ||
namlen > MAXNAMLEN ||
type > 15)
- return (0);
+ goto bad;
for (cp = dp->d_name, size = 0; size < namlen; size++)
if (*cp == '\0' || (*cp++ == '/'))
- return (0);
+ goto bad;
if (*cp != '\0')
- return (0);
+ goto bad;
return (1);
+bad:
+ if (debug)
+ printf("Bad dir: ino %d reclen %d namlen %d type %d name %s\n",
+ dp->d_ino, dp->d_reclen, dp->d_namlen, dp->d_type,
+ dp->d_name);
+ return (0);
}
void