From f3b05a74bbff88e0d1b7310618f10b6c2f85ea32 Mon Sep 17 00:00:00 2001 From: Xiang Fan Date: Sun, 21 Jan 2018 00:14:49 +0800 Subject: [PATCH] kernel: devfs: don't notify output-only select events by default Output-only events (B_EVENT_ERROR, B_EVENT_DISCONNECTED and B_EVENT_INVALID, with B_EVENT_INVALID masked out before passing down events) are used to indicate error, so they should not be notified if the device does not have Select(). Bug: 13965 --- src/system/kernel/device_manager/devfs.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/device_manager/devfs.cpp b/src/system/kernel/device_manager/devfs.cpp index c0139f3fe3..4fc5d3102d 100644 --- a/src/system/kernel/device_manager/devfs.cpp +++ b/src/system/kernel/device_manager/devfs.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "BaseDevice.h" #include "FileDevice.h" @@ -1552,8 +1553,12 @@ devfs_select(fs_volume* _volume, fs_vnode* _vnode, void* _cookie, return B_NOT_ALLOWED; // If the device has no select() hook, notify select() now. - if (!vnode->stream.u.dev.device->HasSelect()) - return notify_select_event((selectsync*)sync, event); + if (!vnode->stream.u.dev.device->HasSelect()) { + if (!SELECT_TYPE_IS_OUTPUT_ONLY(event)) + return notify_select_event((selectsync*)sync, event); + else + return B_OK; + } return vnode->stream.u.dev.device->Select(cookie->device_cookie, event, (selectsync*)sync);