Move the array bounds check outside the conditional section, so that it is also performed on macOS.

This commit is contained in:
Andrew Wood
2024-12-22 11:15:29 +00:00
parent 7a4264fe1e
commit 74c75d36cc
+4 -1
View File
@@ -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.
*/