Subject: Re: bin/3615: umount change to allow relative path unmounting
To: None <netbsd-bugs@NetBSD.ORG>
From: eric richard haszlakiewicz <haszlaki@students.uiuc.edu>
List: netbsd-bugs
Date: 05/13/1997 17:54:03
> >Number: 3615
> >Category: bin
> >Synopsis: umount can't unmount mount points that are not absolute pathnames
[snip]
> >Fix:
> This fix makes umount not use the resolved path unless the relative
> path doesn't work. Relative path works only if you're in the same directory
> you mounted from.
>
> *** umount.c.old Mon May 12 20:44:45 1997
> --- umount.c Tue May 13 17:09:38 1997
[snip]
hmm, I think i missed a case there. Additional patch:
*** umount.c.mid Tue May 13 17:12:07 1997
--- umount.c Tue May 13 17:39:53 1997
*************** umountfs(name)
*** 186,198 ****
mntpt = name;
if (stat(name, &sb) < 0) {
! if ((name = getmntname(mntpt, MNTFROM, type)) == NULL) {
name = rname;
if ((mntpt = getmntname(name, MNTON, type)) == NULL) {
! warnx("%s: not currently mounted", name);
! return (1);
}
}
} else if (S_ISBLK(sb.st_mode)) {
if ((mntpt = getmntname(name, MNTON, type)) == NULL) {
name = rname; /* Try the resolved name */
--- 186,207 ----
mntpt = name;
if (stat(name, &sb) < 0) {
! if ((name = getmntname(mntpt, MNTFROM, type)) == NULL) {
! /* Nope, not mounted there. Restore the name; try again */
! name = mntpt;
! if ((mntpt = getmntname(name, MNTON, type)) == NULL) {
! /* Ok, lets try the resolved name */
! mntpt = rname;
! if ((name = getmntname(mntpt, MNTFROM, type)) == NULL) {
! /* Restore it again. Last try */
name = rname;
if ((mntpt = getmntname(name, MNTON, type)) == NULL) {
! warnx("%s: not currently mounted", name);
! return (1);
}
+ }
}
+ }
} else if (S_ISBLK(sb.st_mode)) {
if ((mntpt = getmntname(name, MNTON, type)) == NULL) {
name = rname; /* Try the resolved name */
eric
haszlaki@uiuc.edu