[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tail, tee: avoid issues with many files on systems without poll
From: |
Pádraig Brady |
Subject: |
[PATCH] tail, tee: avoid issues with many files on systems without poll |
Date: |
Mon, 6 Mar 2023 13:05:59 +0000 |
* src/iopoll.c (iopoll): Protect the call to select against
passing in a descriptor larger than FD_SETSIZE.
---
src/iopoll.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/iopoll.c b/src/iopoll.c
index a73ce05bf..ca27595e3 100644
--- a/src/iopoll.c
+++ b/src/iopoll.c
@@ -86,6 +86,12 @@ iopoll (int fdin, int fdout, bool block)
int nfds = (fdin > fdout ? fdin : fdout) + 1;
int ret = 0;
+ if (FD_SETSIZE < nfds)
+ {
+ errno = EINVAL;
+ ret = -1;
+ }
+
/* If fdout has an error condition (like a broken pipe) it will be seen
as ready for reading. Assumes fdout is not actually readable. */
while (0 <= ret || errno == EINTR)
--
2.26.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tail, tee: avoid issues with many files on systems without poll,
Pádraig Brady <=