Skip to content

Commit b2c338b

Browse files
committed
Don't add sockfd to fd_set if it is invalid.
serial_poll() only uses the validity of the connfd descriptor to determine if the serial module has been initialized, but it must also check if the sockfd has been opened before accepting connections on it. Reported-by: Luigi Leonardi <[email protected]>
1 parent 36cd767 commit b2c338b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/serial.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ static void serial_poll(void) {
4848
timeout.tv_sec = 0;
4949
timeout.tv_usec = 0;
5050

51+
if (sockfd < 0)
52+
return;
53+
5154
if (connfd == -1) {
5255
fd_set accept_set;
5356
FD_ZERO(&accept_set);

0 commit comments

Comments
 (0)