summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--disk-utils/mkswap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index dec34e1ae..43129a7d1 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -582,6 +582,11 @@ main(int argc, char **argv) {
PAGES * pagesize / 1024);
}
+ if (is_mounted(device_name))
+ errx(EXIT_FAILURE, _("error: "
+ "%s is mounted; will not make swapspace."),
+ device_name);
+
if (stat(device_name, &statbuf) < 0) {
perror(device_name);
exit(EXIT_FAILURE);
@@ -598,10 +603,6 @@ main(int argc, char **argv) {
if (!S_ISBLK(statbuf.st_mode))
check=0;
- else if (is_mounted(device_name))
- errx(EXIT_FAILURE, _("error: "
- "%s is mounted; will not make swapspace."),
- device_name);
else if (blkdev_is_misaligned(DEV))
warnx(_("warning: %s is misaligned"), device_name);