When opening the node O_RDWR failed, we try again O_RDONLY, but we did that only, if the returned error code was B_READ_ONLY_DEVICE or B_PERMISSION_DENIED. Some FS return other error codes though, so we are completely ignorant now and always retry on error. Maybe we shouldn't for obvious cases like B_ENTRY_NOT_FOUND.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10679 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-12 03:33:25 +00:00
parent 51634653c6
commit a368fecb8d
1 changed files with 2 additions and 2 deletions

View File

@ -700,7 +700,7 @@ BNode::_SetTo(int fd, const char *path, bool traverse)
if (error == B_OK) {
int traverseFlag = (traverse ? 0 : O_NOTRAVERSE);
fFd = _kern_open(fd, path, O_RDWR | traverseFlag);
if (fFd == B_READ_ONLY_DEVICE || fFd == B_PERMISSION_DENIED) {
if (fFd < B_OK) {
// opening read-write failed, re-try read-only
fFd = _kern_open(fd, path, O_RDONLY | traverseFlag);
}
@ -734,7 +734,7 @@ BNode::_SetTo(const entry_ref *ref, bool traverse)
int traverseFlag = (traverse ? 0 : O_NOTRAVERSE);
fFd = _kern_open_entry_ref(ref->device, ref->directory, ref->name,
O_RDWR | traverseFlag);
if (fFd == B_READ_ONLY_DEVICE || fFd == B_PERMISSION_DENIED) {
if (fFd < B_OK) {
// opening read-write failed, re-try read-only
fFd = _kern_open_entry_ref(ref->device, ref->directory, ref->name,
O_RDONLY | traverseFlag);