Skip to content

Commit

Permalink
[sctp] make coverity scan happy by using a different variable assignment
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Jul 18, 2019
1 parent 800a980 commit c9b1d95
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libknet/transport_sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,20 +601,25 @@ static void _handle_connected_sctp(knet_handle_t knet_h, int connect_sock)

static void _handle_connected_sctp_errors(knet_handle_t knet_h)
{
int sockfd = -1;
int sockfd = 0, infd = -1;
sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP];
sctp_connect_link_info_t *info;

if (recv(handle_info->connectsockfd[0], &sockfd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL) != sizeof(int)) {
if (recv(handle_info->connectsockfd[0], &infd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL) != sizeof(int)) {
log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Short read on connectsockfd");
return;
}

if (_is_valid_fd(knet_h, sockfd) < 1) {
if (_is_valid_fd(knet_h, infd) < 1) {
log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received stray notification for connected socket fd error");
return;
}

/*
* make coverity scan happy by separating variables
*/
sockfd = infd;

log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Processing connected error on socket: %d", sockfd);

info = knet_h->knet_transport_fd_tracker[sockfd].data;
Expand Down

0 comments on commit c9b1d95

Please sign in to comment.