Yeah, sure, don't compile stuff before checking it in.
bfs_open_dir() now checks for read access. bfs_lookup() now checks for execute access and not read access anymore (as reported by Ingo as well). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10273 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2110,7 +2110,7 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
|
|||||||
|
|
||||||
if (openMode & O_TRUNC) {
|
if (openMode & O_TRUNC) {
|
||||||
// we need write access in order to truncate the file
|
// we need write access in order to truncate the file
|
||||||
status = inode->CheckPermission(W_OK);
|
status = inode->CheckPermissions(W_OK);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -2136,6 +2136,8 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
|
|||||||
} else if (parent && (mode & S_ATTR_DIR) == 0)
|
} else if (parent && (mode & S_ATTR_DIR) == 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
status_t status;
|
||||||
|
|
||||||
// do we have the power to create new files at all?
|
// do we have the power to create new files at all?
|
||||||
if (parent != NULL && (status = parent->CheckPermissions(W_OK)) != B_OK)
|
if (parent != NULL && (status = parent->CheckPermissions(W_OK)) != B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
@@ -2144,7 +2146,7 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
|
|||||||
InodeAllocator allocator(transaction);
|
InodeAllocator allocator(transaction);
|
||||||
block_run run;
|
block_run run;
|
||||||
Inode *inode;
|
Inode *inode;
|
||||||
status_t status = allocator.New(&parentRun, mode, run, &inode);
|
status = allocator.New(&parentRun, mode, run, &inode);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ bfs_lookup(void *_ns, void *_directory, const char *file, vnode_id *_vnodeID, in
|
|||||||
Inode *directory = (Inode *)_directory;
|
Inode *directory = (Inode *)_directory;
|
||||||
|
|
||||||
// check access permissions
|
// check access permissions
|
||||||
status_t status = directory->CheckPermissions(R_OK);
|
status_t status = directory->CheckPermissions(X_OK);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
RETURN_ERROR(status);
|
RETURN_ERROR(status);
|
||||||
|
|
||||||
@@ -742,7 +742,7 @@ bfs_create(void *_ns, void *_directory, const char *name, int omode, int mode,
|
|||||||
#endif
|
#endif
|
||||||
Transaction transaction(volume, directory->BlockNumber());
|
Transaction transaction(volume, directory->BlockNumber());
|
||||||
|
|
||||||
status = Inode::Create(transaction, directory, name, S_FILE | (mode & S_IUMSK),
|
status_t status = Inode::Create(transaction, directory, name, S_FILE | (mode & S_IUMSK),
|
||||||
omode, 0, vnodeID);
|
omode, 0, vnodeID);
|
||||||
|
|
||||||
if (status >= B_OK) {
|
if (status >= B_OK) {
|
||||||
@@ -1375,8 +1375,8 @@ bfs_remove_dir(void *_ns, void *_directory, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** creates fs-specific "cookie" struct that keeps track of where
|
/** Opens a directory ready to be traversed.
|
||||||
* you are at in reading through directory entries in bfs_readdir.
|
* bfs_open_dir() is also used by bfs_open_index_dir().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
@@ -1389,6 +1389,10 @@ bfs_open_dir(void *_ns, void *_node, void **_cookie)
|
|||||||
|
|
||||||
Inode *inode = (Inode *)_node;
|
Inode *inode = (Inode *)_node;
|
||||||
|
|
||||||
|
status_t status = inode->CheckPermissions(R_OK);
|
||||||
|
if (status < B_OK)
|
||||||
|
RETURN_ERROR(status);
|
||||||
|
|
||||||
// we don't ask here for directories only, because the bfs_open_index_dir()
|
// we don't ask here for directories only, because the bfs_open_index_dir()
|
||||||
// function utilizes us (so we must be able to open indices as well)
|
// function utilizes us (so we must be able to open indices as well)
|
||||||
if (!inode->IsContainer())
|
if (!inode->IsContainer())
|
||||||
|
|||||||
Reference in New Issue
Block a user