From 5fc7694a544a6cc9f606a5ee3f6787dda732e98f Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 31 Oct 2015 18:06:46 +0000 Subject: 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 --- disk-utils/mkfs.bfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'disk-utils/mkfs.bfs.c') 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); -- cgit v1.2.3-55-g7522