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)
#include "nls.h"
#include "pathnames.h"
#include "bitops.h"
+#include "ismounted.h"
#define ROOT_INO 1
* 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);