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>
This commit is contained in:
parent
8fe1e638fa
commit
5fc7694a54
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue