mirror of https://github.com/schoebel/mars
marsadm: 'create-resource' --force no longer checks for exclusive access
This commit is contained in:
parent
72a2537c6d
commit
0d8d637dee
|
@ -863,8 +863,12 @@ sub create_res {
|
|||
my $size = 0;
|
||||
if (-b $dev) {
|
||||
ldie "block device '$dev' must be an absolute path starting with '/'\n" unless $dev =~ m/^\//;
|
||||
use Fcntl 'SEEK_END', 'O_RDWR', 'O_EXCL';
|
||||
sysopen(TEST, $dev, O_RDWR|O_EXCL) or ldie "cannot open device '$dev' for exclusive rw access\n";
|
||||
use Fcntl 'SEEK_END', 'O_RDONLY', 'O_RDWR', 'O_EXCL';
|
||||
my $flags = O_RDWR | O_EXCL;
|
||||
if (!$force) {
|
||||
$flags = O_RDONLY;
|
||||
}
|
||||
sysopen(TEST, $dev, $flags) or ldie "cannot open device '$dev' for exclusive rw access\n";
|
||||
$size = sysseek(TEST, 0, SEEK_END);
|
||||
close(TEST);
|
||||
lprint "block device '$dev': determined size = $size bytes\n";
|
||||
|
|
Loading…
Reference in New Issue