lib/jsonrpc: check the return value from setsockopt
Change-Id: I47c0635dcc53e28a8c7cfa85416b42c6475a3b65 Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15915 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
a043e45cd1
commit
58549382d0
@ -37,7 +37,13 @@ spdk_jsonrpc_server_listen(int domain, int protocol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = 1;
|
val = 1;
|
||||||
setsockopt(server->sockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
rc = setsockopt(server->sockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
||||||
|
if (rc != 0) {
|
||||||
|
SPDK_ERRLOG("could not set SO_REUSEADDR sock option: %s\n", spdk_strerror(errno));
|
||||||
|
close(server->sockfd);
|
||||||
|
free(server);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
rc = bind(server->sockfd, listen_addr, addrlen);
|
rc = bind(server->sockfd, listen_addr, addrlen);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user