Add ismnt() helper function, wrap fismnt()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-23 19:00:41 +01:00
parent 55479cc511
commit 32b7a14cb3
+8 -3
View File
@@ -81,14 +81,13 @@ static void banner(void)
fprintf(stderr, "\e[2K\e[1m%s %.*s\e[0m\n", buf, SCREEN_WIDTH - (int)strlen(buf) - 2, separator);
}
/* Requires /proc to be mounted */
static int fismnt(char *dir)
static int ismnt(char *file, char *dir)
{
FILE *fp;
int found = 0;
struct mntent *mnt;
fp = setmntent("/proc/mounts", "r");
fp = setmntent(file, "r");
if (!fp)
return 0; /* Dunno, maybe not */
@@ -103,6 +102,12 @@ static int fismnt(char *dir)
return found;
}
/* Requires /proc to be mounted */
static int fismnt(char *dir)
{
return ismnt("/proc/mounts", dir);
}
/*
* Check all filesystems in /etc/fstab with a fs_passno > 0
*/