From 74c75d36ccdf322d30ce0927d93d234d3542f541 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 22 Dec 2024 11:15:29 +0000 Subject: [PATCH] Move the array bounds check outside the conditional section, so that it is also performed on macOS. --- src/pv/watchpid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pv/watchpid.c b/src/pv/watchpid.c index ca03e2f..fe86dc0 100644 --- a/src/pv/watchpid.c +++ b/src/pv/watchpid.c @@ -419,9 +419,12 @@ int pv_watchpid_scanfds(pvstate_t state, #else if (sscanf(d->d_name, "%d", &fd) != 1) continue; +#endif + + /* Skip if the fd is outside the array. */ if ((fd < 0) || (fd >= FD_SETSIZE)) continue; -#endif + /* * Skip if this fd is already known to us. */