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:
Sami Kerola 2015-10-31 18:06:46 +00:00
parent 8fe1e638fa
commit 5fc7694a54
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
1 changed files with 1 additions and 1 deletions

View File

@ -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);