Skip to content

Commit b4491a9

Browse files
committed
sss: mark closed fds as -1 in poll array
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 return immediately with POLLNVAL for closed fds, creating an infinite loop since we only check for POLLIN/POLLPRI. Setting the fd to -1 causes poll() to ignore it, matching epoll behavior.
1 parent 726fcdc commit b4491a9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/pins/sss/clevis-decrypt-sss.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ main(int argc, char *argv[])
260260

261261
fclose(pin->file);
262262
pin->file = NULL;
263+
/* Remove closed fd from poll set (poll ignores negative fds) */
264+
pollfds[pi].fd = -1;
263265

264266
waitpid(pin->pid, NULL, 0);
265267
pin->pid = 0;

0 commit comments

Comments
 (0)