diff options
author | Theodore Ts'o <tytso@mit.edu> | 2005-06-05 16:05:22 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2005-06-05 16:05:22 -0400 |
commit | 2fa8f37ffff4687228d9f204062f2d27b0e5b919 (patch) | |
tree | 00cc7f21dd2f3c05b956990ea84322c02013dc8c /misc/util.c | |
parent | 8198e7912663eb13680391979bfb6177f478e9e0 (diff) | |
download | e2fsprogs-2fa8f37ffff4687228d9f204062f2d27b0e5b919.tar.gz |
On Linux 2.6 systems, mke2fs and badblocks will check to see whether
the filesystem appears to be busy; if so, the programs will print an
error message and abort. (Addresses Debian Bug #308594).
Diffstat (limited to 'misc/util.c')
-rw-r--r-- | misc/util.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/misc/util.c b/misc/util.c index 77359c84..a08a8dd6 100644 --- a/misc/util.c +++ b/misc/util.c @@ -152,17 +152,26 @@ void check_mount(const char *device, int force, const char *type) device); return; } - if (!(mount_flags & EXT2_MF_MOUNTED)) - return; - - fprintf(stderr, _("%s is mounted; "), device); - if (force) { - fputs(_("mke2fs forced anyway. Hope /etc/mtab is " - "incorrect.\n"), stderr); - } else { + if (mount_flags & EXT2_MF_MOUNTED) { + fprintf(stderr, _("%s is mounted; "), device); + if (force) { + fputs(_("mke2fs forced anyway. Hope /etc/mtab is " + "incorrect.\n"), stderr); + return; + } + abort_mke2fs: fprintf(stderr, _("will not make a %s here!\n"), type); exit(1); } + if (mount_flags & EXT2_MF_BUSY) { + fprintf(stderr, _("%s is apparently in use by the system; "), + device); + if (force) { + fputs(_("mke2fs forced anyway.\n"), stderr); + return; + } + goto abort_mke2fs; + } } void parse_journal_opts(const char *opts) |