From: Karel Zak Date: Fri, 11 Mar 2011 13:15:47 +0000 (+0100) Subject: fsck.minix: use lib/ismounted.c X-Git-Tag: v2.20-rc1~452 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0f6d6d0c4d311a9ca7d29024e9d2e01756f0bdd;p=thirdparty%2Futil-linux.git fsck.minix: use lib/ismounted.c Signed-off-by: Karel Zak --- diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am index c950ff6dc9..e95eddb95c 100644 --- a/disk-utils/Makefile.am +++ b/disk-utils/Makefile.am @@ -20,7 +20,7 @@ dist_man_MANS = isosize.8 mkfs.8 mkswap.8 \ sbin_PROGRAMS = mkfs mkswap fsck.minix mkfs.minix mkfs.bfs -fsck_minix_SOURCES = fsck.minix.c minix.h +fsck_minix_SOURCES = fsck.minix.c minix.h $(top_srcdir)/lib/ismounted.c mkfs_minix_SOURCES = mkfs.minix.c minix.h $(utils_common) mkfs_bfs_SOURCES = mkfs.bfs.c $(utils_common) diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index 0ce719641d..4ee053f6bb 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -106,6 +106,7 @@ #include "nls.h" #include "pathnames.h" #include "bitops.h" +#include "ismounted.h" #define ROOT_INO 1 @@ -294,32 +295,13 @@ ask(const char * string, int def) { * 1994 Theodore Ts'o. Also licensed under GPL. */ static void -check_mount(void) { - FILE * f; - struct mntent * mnt; +check_mount(void) +{ int cont; - int fd; - if ((f = setmntent (_PATH_MOUNTED, "r")) == NULL) - return; - while ((mnt = getmntent (f)) != NULL) - if (strcmp (device_name, mnt->mnt_fsname) == 0) - break; - endmntent (f); - if (!mnt) + if (!is_mounted(device_name)) return; - /* - * If the root is mounted read-only, then /etc/mtab is - * probably not correct; so we won't issue a warning based on - * it. - */ - fd = open(_PATH_MOUNTED, O_RDWR); - if (fd < 0 && errno == EROFS) - return; - else - close(fd); - printf (_("%s is mounted. "), device_name); if (isatty(0) && isatty(1)) cont = ask(_("Do you really want to continue"), 0);