]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: close client file descriptor if POLLERR is indicated
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 30 Jan 2018 13:54:30 +0000 (08:54 -0500)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 30 Jan 2018 14:01:01 +0000 (09:01 -0500)
POLLERR is indicated in some error cases when using the chardev with the
vtpm_proxy with runc. In case the flag is set, we terminate the client
connection rather than endlessly looping.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
src/swtpm/mainloop.c

index 648678b2c3908eebfaaf4f5f748dad2560d48d77..cc3c034b75f0292ed439d62bdb878c1e8b736246 100644 (file)
@@ -162,7 +162,7 @@ int mainLoop(struct mainLoopParams *mlp,
                 break;
             }
 
-            if (pollfds[DATA_CLIENT_FD].revents & POLLHUP) {
+            if (pollfds[DATA_CLIENT_FD].revents & (POLLHUP | POLLERR)) {
                 logprintf(STDERR_FILENO, "Data client disconnected\n");
                 mlp->fd = -1;
                 /* chardev and unixio get this signal, not tcp */