* Fixed the bug described by Salvatore: since we let BFS open directories with
read/write access, we shouldn't let it truncate the directory B+tree... * Also fixed allowing truncation in read-only mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26416 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1147,7 +1147,14 @@ bfs_open(fs_volume *_volume, fs_vnode *_node, int openMode, void **_cookie)
|
||||
cookie->last_notification = system_time();
|
||||
|
||||
// Should we truncate the file?
|
||||
if (openMode & O_TRUNC) {
|
||||
if ((openMode & O_TRUNC) != 0) {
|
||||
if ((openMode & O_RWMASK) == O_RDONLY)
|
||||
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());
|
||||
WriteLocker locker(inode->Lock());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user