[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tail: avoid undefined behavior when polling outputs
From: |
Pádraig Brady |
Subject: |
[PATCH] tail: avoid undefined behavior when polling outputs |
Date: |
Tue, 28 Feb 2023 13:35:57 +0000 |
* src/tail.c (check_output_available): Only check the returned
events from poll() when it indicates there are events to check.
---
src/tail.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tail.c b/src/tail.c
index e2e7f4690..938bd3a73 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -369,7 +369,7 @@ check_output_alive (void)
pfd.events = pfd.revents = 0;
pfd.events |= POLLRDBAND; /* Needed for illumos, macos. */
- if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & (POLLERR | POLLHUP)))
+ if (poll (&pfd, 1, 0) > 0 && (pfd.revents & (POLLERR | POLLHUP)))
die_pipe ();
#else
struct timeval delay;
--
2.26.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tail: avoid undefined behavior when polling outputs,
Pádraig Brady <=