--- src/sbin/mount/mount.c.orig Wed Feb 7 00:01:41 2007 +++ src/sbin/mount/mount.c Mon Jun 18 16:08:01 2007 @@ -155,6 +155,7 @@ pid_t pid; int all, ch, i, init_flags, late, mntsize, rval, have_fstab, ro; char *cp, *ep, *options; + char *arg1, tryargv[PATH_MAX]; all = init_flags = late = 0; ro = 0; @@ -267,12 +268,17 @@ if (vfslist != NULL) usage(); - rmslashes(*argv, *argv); + arg1 = *argv; + rmslashes(arg1, arg1); if (init_flags & MNT_UPDATE) { mntfromname = NULL; have_fstab = 0; - if ((mntbuf = getmntpt(*argv)) == NULL) - errx(1, "not currently mounted %s", *argv); + if ((mntbuf = getmntpt(arg1)) == NULL) { + if (realpath(arg1, tryargv) == NULL || + (mntbuf = getmntpt(tryargv)) == NULL) + errx(1, "not currently mounted %s", arg1); + arg1 = tryargv; + } /* * Only get the mntflags from fstab if both mntpoint * and mntspec are identical. Also handle the special @@ -306,13 +312,18 @@ mntbuf->f_mntonname, init_flags, options, 0); break; } - if ((fs = getfsfile(*argv)) == NULL && - (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system", - *argv); +tryagain: + if ((fs = getfsfile(arg1)) == NULL && + (fs = getfsspec(arg1)) == NULL) { + if (arg1 == tryargv || realpath(arg1, tryargv) == NULL) + errx(1, "%s: unknown special file or file system", + arg1); + arg1 = tryargv; + goto tryagain; + + } if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type", - *argv); + errx(1, "%s has unknown file system type", arg1); rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, fs->fs_mntops); break;