]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkfs.bfs: fix block device open race
authorSami Kerola <kerolasa@iki.fi>
Sat, 31 Oct 2015 18:06:46 +0000 (18:06 +0000)
committerSami Kerola <kerolasa@iki.fi>
Sun, 22 Nov 2015 20:56:37 +0000 (20:56 +0000)
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>
disk-utils/mkfs.bfs.c

index 70571945db9dee4c426650058a4140f84553f5fd..ff075678bc3ec826329ea2d1e4a3221f5dad1c8d 100644 (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);