diff options
author | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2014-04-26 16:12:31 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-04-26 16:12:31 +0000 |
commit | 907c3eb800a04c6266d1dae519cba2ba46de8f49 (patch) | |
tree | d53f8c4d58abaf1c61e36d8300e46219be2b5a32 /serprog.c | |
parent | 789ea5e9bbf5f19b56c0f55b795910a423fa2aed (diff) | |
download | flashrom-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>
Diffstat (limited to 'serprog.c')
-rw-r--r-- | serprog.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |