* revert r32999 and adjusted each filesystem to return B_NOT_A_DIRECTORY in
its open_dir() implementation instead (as suggested by Ingo). -alphabranch (it's only a cleanup) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33025 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
30fd88d297
commit
425cb3d716
@ -1576,7 +1576,7 @@ bfs_open_dir(fs_volume* _volume, fs_vnode* _node, void** _cookie)
|
|||||||
// 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())
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_NOT_A_DIRECTORY);
|
||||||
|
|
||||||
BPlusTree* tree = inode->Tree();
|
BPlusTree* tree = inode->Tree();
|
||||||
if (tree == NULL)
|
if (tree == NULL)
|
||||||
|
@ -1785,7 +1785,7 @@ cdda_open_dir(fs_volume* _volume, fs_vnode* _node, void** _cookie)
|
|||||||
|
|
||||||
Inode* inode = (Inode*)_node->private_node;
|
Inode* inode = (Inode*)_node->private_node;
|
||||||
if (!S_ISDIR(inode->Type()))
|
if (!S_ISDIR(inode->Type()))
|
||||||
return B_BAD_VALUE;
|
return B_NOT_A_DIRECTORY;
|
||||||
|
|
||||||
if (inode != &volume->RootNode())
|
if (inode != &volume->RootNode())
|
||||||
panic("pipefs: found directory that's not the root!");
|
panic("pipefs: found directory that's not the root!");
|
||||||
|
@ -437,7 +437,7 @@ ext2_open_dir(fs_volume *_volume, fs_vnode *_node, void **_cookie)
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (!inode->IsDirectory())
|
if (!inode->IsDirectory())
|
||||||
return B_BAD_VALUE;
|
return B_NOT_A_DIRECTORY;
|
||||||
|
|
||||||
DirectoryIterator* iterator = new(std::nothrow) DirectoryIterator(inode);
|
DirectoryIterator* iterator = new(std::nothrow) DirectoryIterator(inode);
|
||||||
if (iterator == NULL)
|
if (iterator == NULL)
|
||||||
|
@ -1180,14 +1180,14 @@ ramfs_open_dir(fs_volume /*fs*/, fs_vnode _node, fs_cookie *_cookie)
|
|||||||
Node *node = (Node*)_node;
|
Node *node = (Node*)_node;
|
||||||
FUNCTION(("dir: (%Lu)\n", node->GetID()));
|
FUNCTION(("dir: (%Lu)\n", node->GetID()));
|
||||||
// get the Directory
|
// get the Directory
|
||||||
status_t error = (node->IsDirectory() ? B_OK : B_BAD_VALUE);
|
status_t error = (node->IsDirectory() ? B_OK : B_NOT_A_DIRECTORY);
|
||||||
Directory *dir = NULL;
|
Directory *dir = NULL;
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
dir = dynamic_cast<Directory*>(node);
|
dir = dynamic_cast<Directory*>(node);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
FATAL(("Node %Ld pretends to be a Directory, but isn't!\n",
|
FATAL(("Node %Ld pretends to be a Directory, but isn't!\n",
|
||||||
node->GetID()));
|
node->GetID()));
|
||||||
error = B_BAD_VALUE;
|
error = B_NOT_A_DIRECTORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// create a DirectoryCookie
|
// create a DirectoryCookie
|
||||||
|
@ -510,7 +510,7 @@ reiserfs_open_dir(fs_volume *fs, fs_vnode *_node, void **cookie)
|
|||||||
VNode *node = (VNode*)_node->private_node;
|
VNode *node = (VNode*)_node->private_node;
|
||||||
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
|
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
|
||||||
node->GetObjectID()));
|
node->GetObjectID()));
|
||||||
status_t error = (node->IsDir() ? B_OK : B_BAD_VALUE);
|
status_t error = (node->IsDir() ? B_OK : B_NOT_A_DIRECTORY);
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
DirectoryCookie *iterator = new(nothrow) DirectoryCookie(
|
DirectoryCookie *iterator = new(nothrow) DirectoryCookie(
|
||||||
volume->GetTree(), node->GetDirID(), node->GetObjectID());
|
volume->GetTree(), node->GetDirID(), node->GetObjectID());
|
||||||
|
@ -310,7 +310,7 @@ udf_open_dir(fs_volume *volume, fs_vnode *vnode, void **cookie)
|
|||||||
if (!dir->IsDirectory()) {
|
if (!dir->IsDirectory()) {
|
||||||
TRACE_ERROR(("udf_open_dir: given Icb is not a directory (type: %d)\n",
|
TRACE_ERROR(("udf_open_dir: given Icb is not a directory (type: %d)\n",
|
||||||
dir->Type()));
|
dir->Type()));
|
||||||
return B_BAD_VALUE;
|
return B_NOT_A_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryIterator *iterator = NULL;
|
DirectoryIterator *iterator = NULL;
|
||||||
|
@ -123,10 +123,7 @@ opendir(const char* path)
|
|||||||
|
|
||||||
int fd = _kern_open_dir(-1, path);
|
int fd = _kern_open_dir(-1, path);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (fd == B_BAD_VALUE)
|
errno = fd;
|
||||||
errno = B_NOT_A_DIRECTORY;
|
|
||||||
else
|
|
||||||
errno = fd;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user