Author: bonefish Date: 2010-07-20 10:44:30 +0200 (Tue, 20 Jul 2010) New Revision: 37614 Changeset: http://dev.haiku-os.org/changeset/37614 Modified: haiku/trunk/src/tests/system/kernel/file_corruption/fs/Volume.cpp Log: When opening the device read-write failed, retry read-only. Modified: haiku/trunk/src/tests/system/kernel/file_corruption/fs/Volume.cpp =================================================================== --- haiku/trunk/src/tests/system/kernel/file_corruption/fs/Volume.cpp 2010-07-20 08:28:55 UTC (rev 37613) +++ haiku/trunk/src/tests/system/kernel/file_corruption/fs/Volume.cpp 2010-07-20 08:44:30 UTC (rev 37614) @@ -70,7 +70,17 @@ 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;