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:
Ingo Weinhold 2010-07-20 08:44:30 +00:00
parent 814057885c
commit c6bc0bdd73

View File

@ -70,7 +70,17 @@ status_t
Volume::Init(const char* 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)
return errno;