* Removed the work-around that allowed to open directories read/write.
See ticket #3875. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30675 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1168,18 +1168,14 @@ bfs_open(fs_volume* _volume, fs_vnode* _node, int openMode, void** _cookie)
|
|||||||
Volume* volume = (Volume*)_volume->private_volume;
|
Volume* volume = (Volume*)_volume->private_volume;
|
||||||
Inode* inode = (Inode*)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
|
|
||||||
// opening a directory read-only is allowed, although you can't read
|
// Opening a directory read-only is allowed, although you can't read
|
||||||
// any data from it.
|
// any data from it.
|
||||||
if (inode->IsDirectory() && (openMode & O_RWMASK) != 0) {
|
if (inode->IsDirectory() && (openMode & O_RWMASK) != O_RDONLY)
|
||||||
openMode = openMode & ~O_RWMASK;
|
return B_IS_A_DIRECTORY;
|
||||||
// TODO: for compatibility reasons, we don't return an error here...
|
|
||||||
// e.g. "copyattr" tries to do that
|
|
||||||
//return B_IS_A_DIRECTORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t status = inode->CheckPermissions(open_mode_to_access(openMode)
|
status_t status = inode->CheckPermissions(open_mode_to_access(openMode)
|
||||||
| (openMode & O_TRUNC ? W_OK : 0));
|
| (openMode & O_TRUNC ? W_OK : 0));
|
||||||
if (status < B_OK)
|
if (status != B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
|
|
||||||
file_cookie* cookie = new(std::nothrow) file_cookie;
|
file_cookie* cookie = new(std::nothrow) file_cookie;
|
||||||
@@ -1205,10 +1201,6 @@ bfs_open(fs_volume* _volume, fs_vnode* _node, int openMode, void** _cookie)
|
|||||||
if ((openMode & O_TRUNC) != 0) {
|
if ((openMode & O_TRUNC) != 0) {
|
||||||
if ((openMode & O_RWMASK) == O_RDONLY)
|
if ((openMode & O_RWMASK) == O_RDONLY)
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
// TODO: this check is only necessary as long as we allow directories
|
|
||||||
// to be opened r/w, see above.
|
|
||||||
if (inode->IsDirectory())
|
|
||||||
return B_IS_A_DIRECTORY;
|
|
||||||
|
|
||||||
Transaction transaction(volume, inode->BlockNumber());
|
Transaction transaction(volume, inode->BlockNumber());
|
||||||
inode->WriteLockInTransaction(transaction);
|
inode->WriteLockInTransaction(transaction);
|
||||||
|
|||||||
Reference in New Issue
Block a user