FIONBIO and FIONREAD don't apply to directories, files, attributes: returns ENOTTY in these cases. This fixes #7279.
ENOTTY could also be replaced with a B_ error code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40686 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
@@ -515,6 +516,17 @@ fd_ioctl(bool kernelFD, int fd, uint32 op, void* buffer, size_t length)
|
|||||||
if (descriptor == NULL)
|
if (descriptor == NULL)
|
||||||
return B_FILE_ERROR;
|
return B_FILE_ERROR;
|
||||||
|
|
||||||
|
if (op == FIONBIO || op == FIONREAD) {
|
||||||
|
switch (descriptor->type) {
|
||||||
|
case FDTYPE_FILE:
|
||||||
|
case FDTYPE_DIR:
|
||||||
|
case FDTYPE_ATTR_DIR:
|
||||||
|
case FDTYPE_ATTR:
|
||||||
|
put_fd(descriptor);
|
||||||
|
return ENOTTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (descriptor->ops->fd_ioctl)
|
if (descriptor->ops->fd_ioctl)
|
||||||
status = descriptor->ops->fd_ioctl(descriptor, op, buffer, length);
|
status = descriptor->ops->fd_ioctl(descriptor, op, buffer, length);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user