Author: stefanct Date: Sat Apr 26 18:12:31 2014 New Revision: 1777 URL: http://flashrom.org/trac/flashrom/changeset/1777
Log: CID1129996: Unchecked return value from setsockopt() in serprog.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Acked-by: Stefan Tauner stefan.tauner@alumni.tuwien.ac.at
Modified: trunk/serprog.c
Modified: trunk/serprog.c ============================================================================== --- trunk/serprog.c Sat Apr 26 18:12:15 2014 (r1776) +++ trunk/serprog.c Sat Apr 26 18:12:31 2014 (r1777) @@ -115,7 +115,11 @@ } /* 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