diff options
author | Bin Meng | 2022-10-19 12:20:13 +0200 |
---|---|---|
committer | Paolo Bonzini | 2022-11-06 09:48:26 +0100 |
commit | 4f76b3d9bb1a5b16166217b46a5f50b3a7c2f5a8 (patch) | |
tree | 66bf1e54b326140d7ead6663e33a6e3b342f8ae3 /util | |
parent | Merge tag 'pull-target-arm-20221104' of https://git.linaro.org/people/pmaydel... (diff) | |
download | qemu-4f76b3d9bb1a5b16166217b46a5f50b3a7c2f5a8.tar.gz qemu-4f76b3d9bb1a5b16166217b46a5f50b3a7c2f5a8.tar.xz qemu-4f76b3d9bb1a5b16166217b46a5f50b3a7c2f5a8.zip |
util/main-loop: Fix maximum number of wait objects for win32
The maximum number of wait objects for win32 should be
MAXIMUM_WAIT_OBJECTS, not MAXIMUM_WAIT_OBJECTS + 1.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20221019102015.2441622-1-bmeng.cn@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/main-loop.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/util/main-loop.c b/util/main-loop.c index f00a25451b..de38876064 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -363,10 +363,10 @@ void qemu_del_polling_cb(PollingFunc *func, void *opaque) /* Wait objects support */ typedef struct WaitObjects { int num; - int revents[MAXIMUM_WAIT_OBJECTS + 1]; - HANDLE events[MAXIMUM_WAIT_OBJECTS + 1]; - WaitObjectFunc *func[MAXIMUM_WAIT_OBJECTS + 1]; - void *opaque[MAXIMUM_WAIT_OBJECTS + 1]; + int revents[MAXIMUM_WAIT_OBJECTS]; + HANDLE events[MAXIMUM_WAIT_OBJECTS]; + WaitObjectFunc *func[MAXIMUM_WAIT_OBJECTS]; + void *opaque[MAXIMUM_WAIT_OBJECTS]; } WaitObjects; static WaitObjects wait_objects = {0}; @@ -395,7 +395,7 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque) if (w->events[i] == handle) { found = 1; } - if (found) { + if (found && i < (MAXIMUM_WAIT_OBJECTS - 1)) { w->events[i] = w->events[i + 1]; w->func[i] = w->func[i + 1]; w->opaque[i] = w->opaque[i + 1]; |