summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/dir.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-07-06 02:03:11 +0000
committermckusick <mckusick@FreeBSD.org>2000-07-06 02:03:11 +0000
commit61ae57db5644ea213c5f6e71034a210758481548 (patch)
tree5bfded644e81cd5a948de9bc77c23fea5fb4c941 /sbin/fsck_ffs/dir.c
parentfc37193d7575813e332e1faffa470fe104a69c99 (diff)
downloadFreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.zip
FreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.tar.gz
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.
Diffstat (limited to 'sbin/fsck_ffs/dir.c')
-rw-r--r--sbin/fsck_ffs/dir.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index f5fb6a0..5ce99f6 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/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
OpenPOWER on IntegriCloud