summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2010-04-02 12:49:07 +0200
committerKarel Zak2010-04-02 12:49:07 +0200
commit1f7a33f1352f823654851bcfd0a2622396489824 (patch)
tree12a9fc145f7b558ff79a46c28ba72bc806ca3ee2
parentswapon: move DELETED_SUFFIX to include/pathnames.h (diff)
downloadkernel-qcow2-util-linux-1f7a33f1352f823654851bcfd0a2622396489824.tar.gz
kernel-qcow2-util-linux-1f7a33f1352f823654851bcfd0a2622396489824.tar.xz
kernel-qcow2-util-linux-1f7a33f1352f823654851bcfd0a2622396489824.zip
mkswap: zap bootbits on regular files
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--disk-utils/mkswap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index 54951991e..09a9a0a40 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -372,7 +372,7 @@ check_mount(void) {
}
static void
-zap_bootbits(int fd, const char *devname, int force)
+zap_bootbits(int fd, const char *devname, int force, int is_blkdev)
{
char *type = NULL;
int whole = 0;
@@ -382,7 +382,7 @@ zap_bootbits(int fd, const char *devname, int force)
if (lseek(fd, 0, SEEK_SET) != 0)
die(_("unable to rewind swap-device"));
- if (is_whole_disk_fd(fd, devname)) {
+ if (is_blkdev && is_whole_disk_fd(fd, devname)) {
/* don't zap bootbits on whole disk -- we know nothing
* about bootloaders on the device */
whole = 1;
@@ -625,7 +625,7 @@ main(int argc, char ** argv) {
if (check)
check_blocks();
- zap_bootbits(DEV, device_name, force);
+ zap_bootbits(DEV, device_name, force, S_ISBLK(statbuf.st_mode));
p->version = 1;
p->last_page = PAGES-1;