aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/common
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2002-06-05 12:00:53 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2002-06-05 12:00:53 +0000
commit3795d538a8747c456369d7501c4be62f4ef5f55a (patch)
treea8fbd3592eec0312b18655b426525dc8e09ee0bf /sys/boot/common
parent7cbccd7f797a7c2838b8c09f4c5435d78011d0c5 (diff)
Notes
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/ufsread.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c
index b478c2523bd15..053dbe0014959 100644
--- a/sys/boot/common/ufsread.c
+++ b/sys/boot/common/ufsread.c
@@ -37,12 +37,13 @@
#define FS_TO_VBO(fs, fsb, off) ((off) & VBLKMASK)
/* Buffers that must not span a 64k boundary. */
-static struct dmadat {
+struct dmadat {
char blkbuf[VBLKSIZE]; /* filesystem blocks */
ufs_daddr_t indbuf[VBLKSIZE / sizeof(ufs_daddr_t)]; /* indir blocks */
char sbbuf[SBSIZE]; /* superblock */
char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
-} *dmadat;
+};
+static struct dmadat *dmadat;
static ino_t lookup(const char *);
static ssize_t fsread(ino_t, void *, size_t);
@@ -71,7 +72,7 @@ fsfind(const char *name, ino_t * ino)
s += d->d_reclen;
}
if (n != -1 && ls)
- putchar('\n');
+ printf("\n");
return 0;
}
@@ -86,6 +87,8 @@ lookup(const char *path)
ino = ROOTINO;
dt = DT_DIR;
+ name[0] = '/';
+ name[1] = '\0';
for (;;) {
if (*path == '/')
path++;
@@ -97,6 +100,10 @@ lookup(const char *path)
ls = *path == '?' && n == 1 && !*s;
memcpy(name, path, n);
name[n] = 0;
+ if (dt != DT_DIR) {
+ printf("%s: not a directory.\n", name);
+ return (0);
+ }
if ((dt = fsfind(name, &ino)) <= 0)
break;
path = s;
@@ -180,4 +187,3 @@ fsread(ino_t inode, void *buf, size_t nbyte)
}
return nbyte;
}
-