Use statfs instead of getmntinfo(). This will make the procfs checks

play nicer in prisons. It also simplifies things.

Reviewed by:	rwatson
Bumped into by:	Jilles Tjoelker
This commit is contained in:
Christian S.J. Peron 2004-11-19 16:11:54 +00:00
parent cd77596356
commit d8654c644a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137890

View File

@ -1179,16 +1179,13 @@ kludge_oldps_options(const char *optlist, char *origval, const char *nextarg)
static int
check_procfs(void)
{
struct statfs *mntbuf;
size_t mntsize, i;
struct statfs mnt;
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for (i = 0; i < mntsize; i++)
if (strcmp(mntbuf[i].f_mntonname, "/proc") == 0 &&
strcmp(mntbuf[i].f_fstypename, "procfs") == 0) {
return (1);
}
return (0);
if (statfs("/proc", &mnt) < 0)
return (0);
if (strcmp(mnt.f_fstypename, "procfs") != 0)
return (0);
return (1);
}
static void