summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2014-04-26 16:12:31 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-04-26 16:12:31 +0000
commit907c3eb800a04c6266d1dae519cba2ba46de8f49 (patch)
treed53f8c4d58abaf1c61e36d8300e46219be2b5a32
parent789ea5e9bbf5f19b56c0f55b795910a423fa2aed (diff)
downloadflashrom-907c3eb800a04c6266d1dae519cba2ba46de8f49.tar.gz
flashrom-907c3eb800a04c6266d1dae519cba2ba46de8f49.tar.bz2
flashrom-907c3eb800a04c6266d1dae519cba2ba46de8f49.zip
CID1129996: Unchecked return value from setsockopt() in serprog
Corresponding to flashrom svn r1777. Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r--serprog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/serprog.c b/serprog.c
index 86c67e0b1..35c4f3203 100644
--- a/serprog.c
+++ b/serprog.c
@@ -115,7 +115,11 @@ static int sp_opensocket(char *ip, unsigned int port)
}
/* We are latency limited, and sometimes do write-write-read *
* (write-n) - so enable TCP_NODELAY. */
- setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
+ if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int))) {
+ close(sock);
+ msg_perr("Error: serprog cannot set socket options: %s\n", strerror(errno));
+ return -1;
+ }
return sock;
}
#endif