In get_exportlist(), properly loop over mounted filesystems.

PR:	bin/99873
Submitted by:	Danny Braniss <danny at cs dot huji dot ac dot il>
This commit is contained in:
Craig Rodrigues 2006-07-08 13:49:24 +00:00
parent 63de936ae8
commit 46f8d30f5a

View File

@ -963,7 +963,7 @@ get_exportlist()
struct export_args export;
struct dirlist *dirhead;
struct iovec *iov;
struct statfs fsb, *fsp;
struct statfs fsb, *fsp, *mntbufp;
struct xucred anon;
struct xvfsconf vfc;
char *cp, *endcp, *dirp, *hst, *usr, *dom, savedc;
@ -1001,10 +1001,9 @@ get_exportlist()
/*
* And delete exports that are in the kernel for all local
* filesystems.
* XXX: Should know how to handle all local exportable filesystems
* instead of just "ufs".
* XXX: Should know how to handle all local exportable filesystems.
*/
num = getmntinfo(&fsp, MNT_NOWAIT);
num = getmntinfo(&mntbufp, MNT_NOWAIT);
if (num > 0) {
build_iovec(&iov, &iovlen, "fstype", NULL, 0);
@ -1016,6 +1015,7 @@ get_exportlist()
}
for (i = 0; i < num; i++) {
fsp = &mntbufp[i];
if (getvfsbyname(fsp->f_fstypename, &vfc) != 0) {
syslog(LOG_ERR, "getvfsbyname() failed for %s",
fsp->f_fstypename);
@ -1052,7 +1052,6 @@ get_exportlist()
"can't delete exports for %s: %m %s",
fsp->f_mntonname, errmsg);
}
fsp++;
}
if (iov != NULL) {