Commit 549c800
committed
sss: handle poll events correctly in clevis-decrypt-sss
When a pin's file descriptor is closed after reading, it must be removed
from the poll set. Unlike epoll (which automatically removes closed fds),
poll() will continue to return events for closed fds.
Additionally, poll() can return POLLHUP/POLLERR/POLLNVAL when a child
process exits or encounters errors. These events must be handled to
avoid infinite loops, but only when there's no data to read (POLLIN not
set) - otherwise we might discard valid data from a process that wrote
output then exited.
This fix:
- Sets closed fds to -1 in the pollfds array (poll ignores negative fds)
- Handles error/hangup events by cleaning up failed pins, but only when
POLLIN is not set, ensuring we read all available data first1 parent 726fcdc commit 549c800
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
231 | 244 | | |
| 245 | + | |
232 | 246 | | |
233 | 247 | | |
234 | 248 | | |
| |||
260 | 274 | | |
261 | 275 | | |
262 | 276 | | |
| 277 | + | |
| 278 | + | |
263 | 279 | | |
264 | 280 | | |
265 | 281 | | |
| |||
0 commit comments