Change a number of B_FILE_ERROR into B_IO_ERROR.

B_FILE_ERROR == EBADF == "Bad file descriptor". It's used
when there's no valid file descriptor, or when attempting
a read or write operation on a file descriptor not opened
with that mode. All other places should use B_IO_ERROR or
some other like value, instead.
This commit is contained in:
Augustin Cavalier
2025-09-03 19:16:06 -04:00
parent 64322ea7d0
commit c04a71fb41
5 changed files with 9 additions and 9 deletions
@@ -200,7 +200,7 @@ Server::WakeCall(Request* request)
if (req == NULL)
return B_OK;
request->fError = B_FILE_ERROR;
request->fError = B_IO_ERROR;
*request->fReply = NULL;
request->fDone = true;
request->fEvent.NotifyAll();
@@ -481,7 +481,7 @@ fs_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
ntfs_inode* ni = ntfs_inode_open(volume->ntfs, node->inode);
if (ni == NULL)
return B_FILE_ERROR;
return B_IO_ERROR;
NtfsInodeCloser niCloser(ni);
if (pos < 0 || pos >= ni->data_size)
@@ -521,7 +521,7 @@ fs_write_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
ntfs_inode* ni = ntfs_inode_open(volume->ntfs, node->inode);
if (ni == NULL)
return B_FILE_ERROR;
return B_IO_ERROR;
NtfsInodeCloser niCloser(ni);
if (pos < 0 || pos >= ni->data_size)
@@ -643,7 +643,7 @@ fs_write_stat(fs_volume* _volume, fs_vnode* _node, const struct stat* stat, uint
ntfs_inode* ni = ntfs_inode_open(volume->ntfs, node->inode);
if (ni == NULL)
return B_FILE_ERROR;
return B_IO_ERROR;
NtfsInodeCloser niCloser(ni);
bool updateTime = false;
@@ -284,7 +284,7 @@ read_table_of_contents(int deviceFD, uint32 first_session, uchar* buffer,
DBG(dump_full_table_of_contents(buffer, buffer_length));
return B_OK;
} else {
error = B_FILE_ERROR;
error = B_IO_ERROR;
TRACE(("%s: scsi ioctl succeeded, but scsi command failed\n",
kModuleDebugName));
}
@@ -792,8 +792,8 @@ status_t MediaReader::FillFileBuffer(
off_t position = GetCurrentFile()->Position();
ssize_t bytesRead = GetCurrentFile()->Read(buffer->Data(),buffer->SizeAvailable());
if (bytesRead < 0) {
PRINT("\t<- B_FILE_ERROR\n");
return B_FILE_ERROR; // some sort of file related error
PRINT("\t<- B_IO_ERROR\n");
return B_IO_ERROR; // some sort of I/O related error
}
PRINT("\t%ld file bytes read at position %ld.\n",
bytesRead, position);
@@ -546,8 +546,8 @@ status_t MediaWriter::WriteFileBuffer(
buffer->SizeUsed(),GetCurrentFile()->Position());
ssize_t bytesWriten = GetCurrentFile()->Write(buffer->Data(),buffer->SizeUsed());
if (bytesWriten < 0) {
fprintf(stderr,"<- B_FILE_ERROR\n");
return B_FILE_ERROR; // some sort of file related error
fprintf(stderr,"<- B_IO_ERROR\n");
return B_IO_ERROR; // some sort of I/O related error
}
// nothing more to say?
return B_OK;