diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index 8eaeee77dc..1221d83e64 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -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() // function utilizes us (so we must be able to open indices as well) if (!inode->IsContainer()) - RETURN_ERROR(B_BAD_VALUE); + RETURN_ERROR(B_NOT_A_DIRECTORY); BPlusTree* tree = inode->Tree(); if (tree == NULL) diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index 8593ec67c8..1152cbcc6d 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -1785,7 +1785,7 @@ cdda_open_dir(fs_volume* _volume, fs_vnode* _node, void** _cookie) Inode* inode = (Inode*)_node->private_node; if (!S_ISDIR(inode->Type())) - return B_BAD_VALUE; + return B_NOT_A_DIRECTORY; if (inode != &volume->RootNode()) panic("pipefs: found directory that's not the root!"); diff --git a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp index 8fca8d5496..80bd7fc31f 100644 --- a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp @@ -437,7 +437,7 @@ ext2_open_dir(fs_volume *_volume, fs_vnode *_node, void **_cookie) return status; if (!inode->IsDirectory()) - return B_BAD_VALUE; + return B_NOT_A_DIRECTORY; DirectoryIterator* iterator = new(std::nothrow) DirectoryIterator(inode); if (iterator == NULL) diff --git a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp index a82bf8e76a..ca3e95c09e 100644 --- a/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ramfs/kernel_interface.cpp @@ -1180,14 +1180,14 @@ ramfs_open_dir(fs_volume /*fs*/, fs_vnode _node, fs_cookie *_cookie) Node *node = (Node*)_node; FUNCTION(("dir: (%Lu)\n", node->GetID())); // 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; if (error == B_OK) { dir = dynamic_cast(node); if (!dir) { FATAL(("Node %Ld pretends to be a Directory, but isn't!\n", node->GetID())); - error = B_BAD_VALUE; + error = B_NOT_A_DIRECTORY; } } // create a DirectoryCookie diff --git a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp index 12400b2529..21bae9ff72 100644 --- a/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/reiserfs/kernel_interface.cpp @@ -510,7 +510,7 @@ reiserfs_open_dir(fs_volume *fs, fs_vnode *_node, void **cookie) VNode *node = (VNode*)_node->private_node; FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), 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) { DirectoryCookie *iterator = new(nothrow) DirectoryCookie( volume->GetTree(), node->GetDirID(), node->GetObjectID()); diff --git a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp index f42b7fcc3c..e0e10948ef 100644 --- a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp @@ -310,7 +310,7 @@ udf_open_dir(fs_volume *volume, fs_vnode *vnode, void **cookie) if (!dir->IsDirectory()) { TRACE_ERROR(("udf_open_dir: given Icb is not a directory (type: %d)\n", dir->Type())); - return B_BAD_VALUE; + return B_NOT_A_DIRECTORY; } DirectoryIterator *iterator = NULL; diff --git a/src/system/libroot/posix/dirent.c b/src/system/libroot/posix/dirent.c index b827ec134d..5db1f26275 100644 --- a/src/system/libroot/posix/dirent.c +++ b/src/system/libroot/posix/dirent.c @@ -123,10 +123,7 @@ opendir(const char* path) int fd = _kern_open_dir(-1, path); if (fd < 0) { - if (fd == B_BAD_VALUE) - errno = B_NOT_A_DIRECTORY; - else - errno = fd; + errno = fd; return NULL; }