mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-01-16 06:17:52 +00:00
swtpm: Check file descriptor >= 0 before closing
Check the file descriptor for >= 0 before closing it. Hopefully this makes Coverity happy. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
9e89ffa12d
commit
fddbb58d48
@ -442,8 +442,11 @@ TPM_RESULT SWTPM_IO_Disconnect(TPM_CONNECTION_FD *connection_fd)
|
||||
TPM_RESULT rc = 0;
|
||||
|
||||
/* close the connection to the client */
|
||||
close(connection_fd->fd);
|
||||
connection_fd->fd = -1; /* mark the connection closed */
|
||||
if (connection_fd->fd >= 0) {
|
||||
close(connection_fd->fd);
|
||||
connection_fd->fd = -1; /* mark the connection closed */
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user