summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.bfs.c
diff options
context:
space:
mode:
authorSami Kerola2015-10-31 19:06:46 +0100
committerSami Kerola2015-11-22 21:56:37 +0100
commit5fc7694a544a6cc9f606a5ee3f6787dda732e98f (patch)
tree56ce62c52411a0070254bb3b992c355de324bcf6 /disk-utils/mkfs.bfs.c
parentlib/blkdev: add open_blkdev_or_file() function (diff)
downloadkernel-qcow2-util-linux-5fc7694a544a6cc9f606a5ee3f6787dda732e98f.tar.gz
kernel-qcow2-util-linux-5fc7694a544a6cc9f606a5ee3f6787dda732e98f.tar.xz
kernel-qcow2-util-linux-5fc7694a544a6cc9f606a5ee3f6787dda732e98f.zip
mkfs.bfs: fix block device open race
This fix makes mkfs.bfs also to detect if block device is busy, and warn if the device is misaligned. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'disk-utils/mkfs.bfs.c')
-rw-r--r--disk-utils/mkfs.bfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c
index 70571945d..ff075678b 100644
--- a/disk-utils/mkfs.bfs.c
+++ b/disk-utils/mkfs.bfs.c
@@ -187,7 +187,7 @@ int main(int argc, char **argv)
if (!S_ISBLK(statbuf.st_mode))
errx(EXIT_FAILURE, _("%s is not a block special device"), device);
- fd = open(device, O_RDWR | O_EXCL);
+ fd = open_blkdev_or_file(&statbuf, device, O_RDWR);
if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), device);