Make `quot -a' work when we've got slashes in the device name.

A very long time ago we had raw device nodes. quot(8) was supposed to
use these  when running `quot -a'. For some reason the code got once
changed to strip the device name until it reaches the last slash. This
is not reliable, because this means /dev/mirror/foo will be stripped to
/dev/foo.

This bug also exists on RELENG_7 and RELENG_6, but I think I'll just
merge them back somewhere after the upcoming releases. There's no rush.

MFC after:	2 months
This commit is contained in:
Ed Schouten 2008-09-14 11:50:19 +00:00
parent 5e7b481acf
commit b4eca7675a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183018

View File

@ -589,8 +589,6 @@ main(int argc, char *argv[])
char all = 0;
struct statfs *mp;
struct fstab *fs;
char dev[MNAMELEN + 1];
char *nm;
int cnt;
func = douser;
@ -631,14 +629,8 @@ main(int argc, char *argv[])
if (all) {
cnt = getmntinfo(&mp,MNT_NOWAIT);
for (; --cnt >= 0; mp++) {
if (!strncmp(mp->f_fstypename, "ufs", MFSNAMELEN)) {
if ((nm = strrchr(mp->f_mntfromname,'/'))) {
sprintf(dev,"%s%s",_PATH_DEV,nm + 1);
nm = dev;
} else
nm = mp->f_mntfromname;
quot(nm,mp->f_mntonname);
}
if (!strncmp(mp->f_fstypename, "ufs", MFSNAMELEN))
quot(mp->f_mntfromname, mp->f_mntonname);
}
}
while (--argc >= 0) {