From 321130660880f23f6fd795b8bc41a0fe81303f6b Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Thu, 16 Feb 2023 16:09:20 +0900 Subject: [PATCH] kernel: fixup issues with timeouts in fswait3 --- kernel/sys/process.c | 2 +- kernel/sys/syscall.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sys/process.c b/kernel/sys/process.c index 4f419d5e..c211fddd 100644 --- a/kernel/sys/process.c +++ b/kernel/sys/process.c @@ -1093,7 +1093,7 @@ int process_wait_nodes(process_t * process,fs_node_t * nodes[], int timeout) { } if (timeout == 0) { - return -2; + return index; } n = nodes; diff --git a/kernel/sys/syscall.c b/kernel/sys/syscall.c index 0618084d..4c81b367 100644 --- a/kernel/sys/syscall.c +++ b/kernel/sys/syscall.c @@ -1090,7 +1090,7 @@ long sys_fswait_multi(int c, int fds[], int timeout, int out[]) { if (has_match != -1) return has_match; int result = sys_fswait_timeout(c, fds, timeout); - if (result >= 0) out[result] = 1; + if (result >= 0 && result < c) out[result] = 1; return result; }