mirror of
https://github.com/troglobit/finit.git
synced 2026-10-21 11:29:42 +00:00
Export ismnt() and fismnt() helper functions, for modprobe plugin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
37d92e87bc
commit
3f5ff0d339
3 files changed
+32
-27
No files matched your search
@@ -429,6 +429,34 @@ void endfsent(void)
|
||||
}
|
||||
#endif /* HAVE_GETFSENT */
|
||||
|
||||
|
||||
int ismnt(char *file, char *dir)
|
||||
{
|
||||
FILE *fp;
|
||||
int found = 0;
|
||||
struct mntent *mnt;
|
||||
|
||||
fp = setmntent(file, "r");
|
||||
if (!fp)
|
||||
return 0; /* Dunno, maybe not */
|
||||
|
||||
while ((mnt = getmntent(fp))) {
|
||||
if (!strcmp(mnt->mnt_dir, dir)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
endmntent(fp);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Requires /proc to be mounted */
|
||||
int fismnt(char *dir)
|
||||
{
|
||||
return ismnt("/proc/mounts", dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
* indent-tabs-mode: t
|
||||
|
||||
Reference in new issue
Block a user