From 32b7a14cb301e2dd3dce4be89415c4cdfd30ef41 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 23 Dec 2017 19:00:03 +0100 Subject: [PATCH] Add ismnt() helper function, wrap fismnt() Signed-off-by: Joachim Nilsson --- src/finit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/finit.c b/src/finit.c index a4d0ac7e..90d37c4b 100644 --- a/src/finit.c +++ b/src/finit.c @@ -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 */