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