Remove leading '/' from pathnames, using same logic as ufs.c. Allows new

style (but not yet committed) pmax bootblocks to open "/boot.pmax" on an
ISO image.  Same problem reported for NFS by Jason Thorpe.
This commit is contained in:
simonb 1999-11-23 12:20:53 +00:00
parent 363014dffa
commit a09d3191a0
2 changed files with 24 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660.c,v 1.10 1999/11/13 21:17:56 thorpej Exp $ */
/* $NetBSD: cd9660.c,v 1.11 1999/11/23 12:20:53 simonb Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@ -209,6 +209,12 @@ cd9660_open(path, f)
bno = isonum_732(pp->block) + isonum_711(pp->extlen);
rc = ENOENT;
/*
* Remove extra separators
*/
while (*path == '/')
path++;
while (*path) {
if ((caddr_t)pp >= (caddr_t)buf + psize)
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs.c,v 1.27 1999/11/13 21:17:57 thorpej Exp $ */
/* $NetBSD: nfs.c,v 1.28 1999/11/23 12:20:53 simonb Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@ -403,8 +403,9 @@ nfs_open(path, f)
struct open_file *f;
{
struct nfs_iodesc *newfd, *currfd;
register char *cp;
#ifndef NFS_NOSYMLINK
register char *cp, *ncp;
register char *ncp;
register int c;
char namebuf[NFS_MAXPATHLEN + 1];
char linkbuf[NFS_MAXPATHLEN + 1];
@ -520,12 +521,21 @@ nfs_open(path, f)
out:
#else
/* allocate file system specific data structure */
currfd = alloc(sizeof(*currfd));
currfd->iodesc = nfs_root_node.iodesc;
currfd->off = 0;
/* allocate file system specific data structure */
currfd = alloc(sizeof(*currfd));
currfd->iodesc = nfs_root_node.iodesc;
currfd->off = 0;
error = nfs_lookupfh(&nfs_root_node, path, currfd);
cp = path;
/*
* Remove extra separators
*/
while (*cp == '/')
cp++;
/* XXX: Check for empty path here? */
error = nfs_lookupfh(&nfs_root_node, cp, currfd);
#endif
if (!error) {
f->f_fsdata = (void *)currfd;