diff options
author | Sami Kerola | 2015-10-31 19:06:46 +0100 |
---|---|---|
committer | Sami Kerola | 2015-11-22 21:56:37 +0100 |
commit | 5fc7694a544a6cc9f606a5ee3f6787dda732e98f (patch) | |
tree | 56ce62c52411a0070254bb3b992c355de324bcf6 /disk-utils/mkfs.bfs.c | |
parent | lib/blkdev: add open_blkdev_or_file() function (diff) | |
download | kernel-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.c | 2 |
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); |