Skip to content

Commit

Permalink
swtpm: Only accept() new client ctrl connection if we have none
Browse files Browse the repository at this point in the history
Only accept new client connection on the control channel if we
currently do not have a client on the control channel.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Jan 23, 2020
1 parent d8ab4eb commit 297ffe2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/swtpm/mainloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int mainLoop(struct mainLoopParams *mlp,
.events = POLLIN,
.revents = 0,
}, {
.fd = ctrlfd,
.fd = -1,
.events = POLLIN,
.revents = 0,
} , {
Expand All @@ -168,6 +168,8 @@ int mainLoop(struct mainLoopParams *mlp,
/* only listend for clients if we don't have one */
if (connection_fd.fd < 0)
pollfds[DATA_SERVER_FD].fd = sockfd;
if (ctrlclntfd < 0)
pollfds[CTRL_SERVER_FD].fd = ctrlfd;

ready = poll(pollfds, 5, -1);
if (ready < 0 && errno == EINTR)
Expand Down

0 comments on commit 297ffe2

Please sign in to comment.