]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsck.minix: use lib/ismounted.c
authorKarel Zak <kzak@redhat.com>
Fri, 11 Mar 2011 13:15:47 +0000 (14:15 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 11 Mar 2011 13:15:47 +0000 (14:15 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/Makefile.am
disk-utils/fsck.minix.c

index c950ff6dc96e4fed4d06af0c9a913669c2a42270..e95eddb95c5f7cc37b24bc468e796d176d7d7bcf 100644 (file)
@@ -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)
 
index 0ce719641d8044014e6bbce898d25e88e6fff352..4ee053f6bb4282f98af6584ce0805eb16300b728 100644 (file)
 #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);