Add ismnt() helper function, wrap fismnt()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-12-23 19:00:41 +01:00
1 parent 55479cc511
commit 32b7a14cb3
1 file changed
+8 -3
+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); 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 ismnt(char *file, char *dir)
static int fismnt(char *dir)
{ {
FILE *fp; FILE *fp;
int found = 0; int found = 0;
struct mntent *mnt; struct mntent *mnt;
fp = setmntent("/proc/mounts", "r"); fp = setmntent(file, "r");
if (!fp) if (!fp)
return 0; /* Dunno, maybe not */ return 0; /* Dunno, maybe not */
@@ -103,6 +102,12 @@ static int fismnt(char *dir)
return found; 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 * Check all filesystems in /etc/fstab with a fs_passno > 0
*/ */