mirror of https://github.com/schoebel/mars
marsadm: add warning on forced disk open
This commit is contained in:
parent
535a376084
commit
0f49f0f03b
|
@ -5388,6 +5388,10 @@ sub create_res {
|
|||
use Fcntl 'SEEK_END', 'O_RDONLY', 'O_RDWR', 'O_EXCL';
|
||||
my $flags = O_RDWR | O_EXCL;
|
||||
if ($force) {
|
||||
sysopen(TEST, $dev, $flags) or
|
||||
lwarn "Cannot open disk device '$dev' for exclusive rw access. "
|
||||
. "I will retry due to --force, hopefully you know the risk, like filesystem corruption.\n";
|
||||
close(TEST);
|
||||
$flags = O_RDONLY;
|
||||
}
|
||||
sysopen(TEST, $dev, $flags) or ldie "cannot open device '$dev' for exclusive rw access\n";
|
||||
|
|
Loading…
Reference in New Issue