When opening the device read-write failed, retry read-only.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37614 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
814057885c
commit
c6bc0bdd73
@ -70,7 +70,17 @@ status_t
|
|||||||
Volume::Init(const char* device)
|
Volume::Init(const char* device)
|
||||||
{
|
{
|
||||||
// open the device
|
// open the device
|
||||||
fFD = open(device, IsReadOnly() ? O_RDONLY : O_RDWR);
|
if (!IsReadOnly()) {
|
||||||
|
fFD = open(device, O_RDWR);
|
||||||
|
|
||||||
|
// If opening read-write fails, we retry read-only.
|
||||||
|
if (fFD < 0)
|
||||||
|
fFlags |= B_FS_IS_READONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsReadOnly())
|
||||||
|
fFD = open(device, O_RDONLY);
|
||||||
|
|
||||||
if (fFD < 0)
|
if (fFD < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user